首页 > 解决方案 > Redis 自动缩放 Ec2

问题描述

我需要帮助来设计满足以下要求的网络: 核心网络资源在至少 2 个区域中重复 网络流量根据用户位置路由到适当的区域 子网的大小和安全性适当 存在所有设备,以便网络可以连接到互联网并相互连接 网络可以容忍互联网事件,并且设计为高度可用的 我需要在设计中包含任何将在此架构中处理信息的设备,即使您没有对其进行隐式控制(路由、防火墙、NAT 网关、互联网网关等)。

在自动创建和解构此服务方面需要帮助。我需要使用任何工具,如 terraform/cloudformation 或 ansible / chef cookbooks 来部署,只要它在代码和/或配置中表示。假设如下: vpc 和子网已经存在 所有资源只需要本地网络访问,并且需要此架构在达到基于通过 cloudwatch/sns 发送的负载和警报的阈值时使用自动扩展启动配置进行扩展和缩减。

标签: amazon-web-servicesamazon-ec2redisautoscalingelastic-load-balancer

解决方案


这个 yaml 自动化代码是否有帮助这是我要尝试的..请让我知道您的输入

Usage
resource "aws_sns_topic" "global" {
  ...
}

resource "aws_elasticache_subnet_group" "redis" {
  ...
}

resource "aws_elasticache_parameter_group" "redis" {
  ...
}

module "cache" {
  source = "github.com/nazeerahamed79/terraform-aws-redis-elasticache"

  vpc_id                     = "vpc-20f74844"
  cache_identifier           = "cache"
  automatic_failover_enabled = "false"
  desired_clusters           = "1"
  instance_type              = "cache.t2.micro"
  engine_version             = "3.2.4"
  parameter_group            = "${aws_elasticache_parameter_group.redis.name}"
  subnet_group               = "${aws_elasticache_subnet_group.redis.name}"
  maintenance_window         = "sun:02:30-sun:03:30"
  notification_topic_arn     = "${aws_sns_topic.global.arn}"

  alarm_cpu_threshold    = "75"
  alarm_memory_threshold = "10000000"
  alarm_actions          = ["${aws_sns_topic.global.arn}"]

  project     = "Redis_deployment"
  environment = "Redis_deployment"
}
Variables
vpc_id - ID of VPC meant to house the cache
project - Name of the project making use of the cluster (default: Redis_deployment)
environment - Name of environment the cluster is targeted for (Redis_Multi_azdeployment: Unknown)
cache_identifier - Name used as ElastiCache cluster ID
automatic_failover_enabled - Flag to determine if automatic failover should be enabled
desired_clusters - Number of cache clusters in replication group
instance_type - Instance type for cache instance (default: cache.t2.micro)
engine_version - Cache engine version (default: 3.2.4)
parameter_group - Cache parameter group name (default: redis3.2)
subnet_group - Cache subnet group name
maintenance_window - Time window to reserve for maintenance
notification_topic_arn - ARN to notify when cache events occur
alarm_cpu_threshold - CPU alarm threshold as a percentage (default: 75)
alarm_memory_threshold - Free memory alarm threshold in bytes (default: 10000000)
alarm_actions - ARN to be notified via CloudWatch when alarm thresholds are triggered
Outputs
id - The replication group ID
cache_security_group_id - Security group ID of the cache cluster
port - Port of replication group leader
endpoint - Public DNS name of replication group leader

推荐阅读