ElastiCache redis or valkey cluster with secure firewall configuration, encryption, multi AZ, backup enabled, and alerting.
Install Node.js and npm first!
npm i @cfn-modules/elasticache-redis
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'cfn-modules example'
Resources:
Cache:
Type: 'AWS::CloudFormation::Stack'
Properties:
Parameters:
VpcModule: !GetAtt 'Vpc.Outputs.StackName' # required
ClientSgModule: !GetAtt 'ClientSg.Outputs.StackName' # required
AlertingModule: '' # optional
BastionModule: '' # optional
KmsKeyModule: '' # optional
Engine: 'redis' # optional
EngineVersion: '7.1' # optional
CacheNodeType: 'cache.t2.micro' # optional
TransitEncryption: 'true' # optional
AuthToken: '' # optional
SnapshotRetentionLimit: '35' # optional
SnapshotName: '' # optional
NumShards: '1' # optional
NumReplicas: '1' # optional
CacheParameterGroupName: '' # optional
TemplateURL: './node_modules/@cfn-modules/elasticache-redis/module.yml'
none
none
| Name | Description | Default | Required? | Allowed values |
|---|---|---|---|---|
| VpcModule | Stack name of vpc module | yes | ||
| ClientSgModule | Stack name of client-sg module where traffic is allowed from on port 6379 to the cache | yes | ||
| AlertingModule | Stack name of alerting module | no | ||
| BastionModule | Stack name of module implementing Bastion | no | ||
| KmsKeyModule | Stack name of kms-key module | no | ||
| Engine | Cache engine | redis | no | [redis, valkey] |
| EngineVersion | Engine version (must match Engine) | 7.1 | no | redis: [5.0.6, 6.0, 6.2, 7.0, 7.1]; valkey: [7.2, 8.0, 8.1, 8.2, 9.0, 9.1] |
| CacheNodeType | The compute and memory capacity of the nodes in the node group (shard); valkey does not support cache.t2.* node types | cache.t2.micro | no | |
| TransitEncryption | Enable [encryption for data in transit](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/in-transit-encryption.html)? | true | no | [true, false] |
| AuthToken | Password (16 to 128 characters) used to authenticate against Redis/Valkey (requires TransitEncryption := true; leave blank to disable password-protection) | no | ||
| SnapshotRetentionLimit | The number of days for which ElastiCache retains automatic snapshots before deleting them (set to 0 to disable backups) | 35 | no | [0...35] |
| SnapshotName | Name of a snapshot from which you want to restore (leave blank to create an empty cache) | no | ||
| NumShards | Number of shards in the cluster. | 1 | no | [1-250] |
| NumReplicas | Number of replicas per shard. | 1 | no | [0-5] |
| CacheParameterGroupName | Name of a cache parameter group | no |
- Scalable: Cache instances capacity (CPU, RAM, network, ...) is limited by design
- Monitoring: Network In+Out is not monitored according to capacity of instance type