Review ElastiCache VPC subnet selection

Verify the cache’s actual VPC and subnets, and allow access only from required applications.

Description

Set cache_subnet_group to choose placement for a new ElastiCache cluster. When it is omitted, the account’s default VPC can be used. Check the actual VPC and subnets.

Potential impact

In the wrong network, the application may have no route to the cache, or clients that do not need it may have one.

Remediation

Choose a subnet group in the intended VPC and allow only required applications to reach the cache port through the security group. To move an existing cache, create a separately named cluster in the target group, populate it and test access from the application before switching clients.

Examples

The second Memcached example selects a group named default during creation. This change alone does not move an existing cluster. Check that the group covers the selected zone and use a supported engine version and node type for a new deployment.

Before

yaml
- name: ElastiCache 생성
  community.aws.elasticache:
    name: test-please-delete
    state: present
    engine: memcached
    cache_engine_version: 1.4.14
    node_type: cache.m1.small
    num_nodes: 1
    cache_port: 11211
    zone: us-east-1d

After

yaml
- name: ElastiCache 생성
  community.aws.elasticache:
    name: test-please-delete
    state: present
    engine: memcached
    cache_engine_version: 1.4.14
    node_type: cache.m1.small
    num_nodes: 1
    cache_port: 11211
    cache_subnet_group: default
    zone: us-east-1d

References