Skip to content

Terraform deployment for Elasticache auto-scaling based on cloudwatch metrics

Notifications You must be signed in to change notification settings

weiwarren/terraform-elasticache-scaling-helper

Repository files navigation

terraform-aws-elasticache-scaling-helper

Terraform module which creates Redis ElastiCache Dynamic Scaling Helper resources on AWS.

Description

Provision elastic cacahe dynamic scaling module

Dependacy

elasticache-scaling-helper

Usage

Complete

module "elasticache_redis" {
  source                = "git::https://github.com/tmknom/terraform-aws-elasticache-redis.git?ref=tags/2.0.0"
  name                  = "example"
  number_cache_clusters = 2
  node_type             = "cache.m3.medium"

  engine_version             = "5.0.0"
  port                       = 56379
  maintenance_window         = "mon:10:40-mon:11:40"
  snapshot_window            = "09:10-10:10"
  snapshot_retention_limit   = 1
  automatic_failover_enabled = false
  at_rest_encryption_enabled = false
  transit_encryption_enabled = false
  apply_immediately          = true
  family                     = "redis5.0"
  description                = "This is example"

  subnet_ids         = var.subnet_ids
  vpc_id             = var.vpc_id
  source_cidr_blocks = var.source_cidr_blocks

  tags = {
    Environment = "prod"
  }
}

module "elasticache_scaling_helper"{
  source                = "../../"
  cache_cluster_name          = "iconic-dev-elasticache"
  number_cache_clusters        = 2
  sqs_name = "elasticache-auto-scaler-sqs"
  sns_name = "elasticache-auto-scaler-sns"
  alarm_name_up="elasticache-auto-scaler-alarm-up"
  alarm_name_down="elasticache-auto-scaler-alarm-down"
  tags = {
    Application = "elasticache-auto-scaler"
    Owner       = "Devops"
    Environment = "dev"
    Project     = "elasticache-auto-scaler"
  }
}

Requirements

Name Version
terraform >= 0.12

Providers

Name Version
aws n/a

Inputs

Outputs

Name Description
aws_sns_topic The sns topic name.
aws_sqs_queue The sqs url
aws_cloudwatch_alarm_up The cloud watch alarm for high threashold.
aws_cloudwatch_alarm_down The cloud watch alarm for low threashold

Configure environment variables

export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
export AWS_DEFAULT_REGION=ap-southeast-2

Installation

git clone [email protected]:weiwarren/terraform-elasticache-scaling-helper.git
cd terraform-elasticache-scaling-helper
make install

Makefile targets

apply-complete                 Run terraform apply examples/complete
bump-version                   Bump version (Required argument 'VERSION')
check-format                   Check format code
clean                          Clean .terraform
destroy-complete               Run terraform destroy examples/complete
diff                           Word diff
docs                           Generate docs
format                         Format code
help                           Show help
install                        Install requirements
lint                           Lint code
plan-complete                  Run terraform plan examples/complete
release                        Release GitHub and Terraform Module Registry
upgrade                        Upgrade makefile

Releasing new versions

Bump VERSION file, and run make release.

Terraform Module Registry

License

Apache 2 Licensed. See LICENSE for full details.

Reference

https://github.com/tmknom/terraform-aws-elasticache-redis

About

Terraform deployment for Elasticache auto-scaling based on cloudwatch metrics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published