ElastiCache nodes not distributed across Availability Zones

Distribute multi-node ElastiCache Memcached clusters across Availability Zones.

Description

A zonal outage can take every Memcached node offline if they all run in one Availability Zone.

Potential impact

Memcached does not replicate data across zones. Losing one node can still increase cache misses and load on the backing store.

Remediation

For at least two nodes, set az_mode = "cross-az" and use a cache subnet group spanning multiple zones. If all existing nodes are in one zone, add nodes in another zone covered by the group and check their placement.

Examples

The example configures placement for three new nodes. Existing nodes stay in their current zones. Supply a supported node type when deploying.

Before

hcl
resource "aws_elasticache_cluster" "example" {
  cluster_id      = "cluster-example"
  engine          = "memcached"
  num_cache_nodes = 3
}

After

hcl
resource "aws_elasticache_cluster" "example" {
  cluster_id      = "cluster-example"
  engine          = "memcached"
  num_cache_nodes = 3
  az_mode         = "cross-az"
}

References