Review ElastiCache ports and access controls

Prioritize actual network scope and supported authentication and encryption over the cache port number.

Description

Memcached defaults to port 11211 and Redis OSS to 6379. Use subnets and security groups to control which applications can reach the cache.

Potential impact

Unnecessary network paths can remain open after a port change. Applications still using the old port lose connectivity.

Remediation

Restrict access to required applications and use authentication and transport encryption supported by the engine. If another port is needed, set cache_port to a supported value. An existing cluster cannot change ports in place. Plan how to populate the new cache and update applications, firewall rules and monitoring.

Examples

The historical Memcached examples use 11211 and 11212. Both use the same cluster name, and the second task does not replace it by default. To run a new cache alongside the old one, use a different name, a supported engine version and node type, and an available subnet group and zone.

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
    cache_subnet_group: default
    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: 11212
    cache_subnet_group: default
    zone: us-east-1d

References