Review ElastiCache VPC and subnet-group selection

Verify the actual ElastiCache subnet group and VPC, and permit connections only from required clients.

Description

CacheSubnetGroupName selects the group of subnets for the cache. If omitted, the account’s default VPC can be used. Check actual routes and security groups to determine reachability.

Potential impact

A cache in the wrong VPC may be unreachable from the application or reachable from clients that do not need it.

Remediation

Select a subnet group in the approved VPC and allow only required clients through the security group. Moving an existing cache to another subnet group replaces the cluster. Review the change set and plan how to repopulate the cache and switch clients.

Examples

The second Memcached example selects a subnet group named default. Check its actual VPC and subnets and choose a node type supported in your environment.

Before

yaml
Resources:
  ElasticacheCluster:
    Type: 'AWS::ElastiCache::CacheCluster'
    Properties:    
      Engine: memcached
      CacheNodeType: cache.t2.micro
      NumCacheNodes: '1'

After

yaml
Resources:
  ElasticacheCluster:
    Type: 'AWS::ElastiCache::CacheCluster'
    Properties:    
      Engine: memcached
      CacheNodeType: cache.t2.micro
      NumCacheNodes: '1'
      CacheSubnetGroupName: default

References