Review default ElastiCache port use

Review the default ElastiCache port against operational policy, while prioritizing network restrictions and supported authentication and encryption.

Description

The replication group’s Port sets the listener for each cache node. Network routes and security groups control which clients can reach it.

Potential impact

Unnecessary network access combined with weak authentication or permissions can leave cache data open to unauthorized reads or changes.

Remediation

Restrict routes and security groups to required clients and use authentication and transport encryption supported by the engine. If policy requires a different port, choose a supported value. Changing the port replaces the replication group. Review the change set and plan how to move the data and switch clients and monitoring.

Examples

The historical Redis OSS examples change 6379 to 6380. Use a supported engine version and node type, and supply the referenced subnet group and security group.

Before

yaml
Resources:
  BasicReplicationGroup:
    Type: 'AWS::ElastiCache::ReplicationGroup'
    Properties:
      AutomaticFailoverEnabled: true    
      CacheNodeType: cache.r3.large
      CacheSubnetGroupName: !Ref CacheSubnetGroup
      Engine: redis
      EngineVersion: '3.2'
      NumNodeGroups: '2'
      ReplicasPerNodeGroup: '3'
      Port: 6379
      PreferredMaintenanceWindow: 'sun:05:00-sun:09:00'
      ReplicationGroupDescription: A sample replication group
      SecurityGroupIds:
        - !Ref ReplicationGroupSG
      SnapshotRetentionLimit: 5
      SnapshotWindow: '10:00-12:00'

After

yaml
Resources:
  BasicReplicationGroup:
    Type: 'AWS::ElastiCache::ReplicationGroup'
    Properties:
      AutomaticFailoverEnabled: true    
      CacheNodeType: cache.r3.large
      CacheSubnetGroupName: !Ref CacheSubnetGroup
      Engine: redis
      EngineVersion: '3.2'
      NumNodeGroups: '2'
      ReplicasPerNodeGroup: '3'
      Port: 6380
      PreferredMaintenanceWindow: 'sun:05:00-sun:09:00'
      ReplicationGroupDescription: A sample replication group
      SecurityGroupIds:
        - !Ref ReplicationGroupSG
      SnapshotRetentionLimit: 5
      SnapshotWindow: '10:00-12:00'

References