Skip to content

Instantly share code, notes, and snippets.

@vinodjayachandran
Last active April 12, 2023 03:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinodjayachandran/86d2f24a74a1a01481c09818ec38fb85 to your computer and use it in GitHub Desktop.
Save vinodjayachandran/86d2f24a74a1a01481c09818ec38fb85 to your computer and use it in GitHub Desktop.
Create AWS ElastiCache (Redis) Cluster with encryption in transit and AUTH token
const redisParameterGroup = new elasticache.CfnParameterGroup(this, 'redisParameterGroup', {
cacheParameterGroupFamily: 'redis7',
description: 'Redis Cluster Parameter Overrides',
properties: {
timeout: '120', // Close connection if client is idle for a given number of seconds
},
});
const redisPrimaryReplicationGroup = new elasticache.CfnReplicationGroup(this, 'redisPrimaryReplicationGroup', {
replicationGroupDescription: '{CLUSTER_DESCRIPTION}',
// the properties below are optional
atRestEncryptionEnabled: false,
authToken: '{YOUR_PASSWORD}',
cacheNodeType: 'cache.r6g.large',
engine: 'redis',
engineVersion: '7.0',
multiAzEnabled: true,
automaticFailoverEnabled: true,
replicasPerNodeGroup: 2,
replicationGroupId: `{UNIQUE_NAME_FOR_CLUSTER}`,
securityGroupIds: [secuityGroup.securityGroupId],
transitEncryptionEnabled: true,
cacheParameterGroupName: redisParameterGroup.ref,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment