An ElastiCache cache node type specifies the compute, memory, and network capacity available to a cache node. Choosing a larger type scales the cache vertically. section 11.6 section 11.6.1
Select production capacity for concurrency, dataset size, growth, memory fragmentation, and network throughput rather than choosing only by price or current utilization. section 11.6.1 section 11.5.1
Use these sizing guidelines:
- Choose at least 2 vCPUs for real production concurrency. section 11.6.1
- Reserve roughly 20% more memory than the current dataset requires for growth and to reduce fragmentation risk. section 11.6.1
- Prefer at least high network performance, especially when network usage contributes to cache bottlenecks. section 11.6 section 11.6.1
- Move to a larger node when memory pressure or CPU demand persists; add shards when horizontal scaling is more appropriate. section 11.5.1 section 11.6
From Free Tier to production
cache.t2.micro provides one vCPU, approximately 0.6 GB of memory, and low-to-moderate network performance. cache.r6g.large provides 2 vCPUs, approximately 13 GB of memory, and up to 10 Gb of network performance, making it a possible small production starting point. section 11.6.1
Listing 11.1 Minimal CloudFormation template of an ElastiCache Redis single-node cluster
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'AWS in Action: chapter 11 (minimal)'
Parameters: #1
VPC:
Type: 'AWS::EC2::VPC::Id'
SubnetA:
Type: 'AWS::EC2::Subnet::Id'
SubnetB:
Type: 'AWS::EC2::Subnet::Id'
Resources:
CacheSecurityGroup: #2
Type: 'AWS::EC2::SecurityGroup'
Properties:
GroupDescription: cache
VpcId: !Ref VPC
SecurityGroupIngress:
- IpProtocol: tcp #3
FromPort: 6379
ToPort: 6379
CidrIp: '0.0.0.0/0'
CacheSubnetGroup: #4
Type: 'AWS::ElastiCache::SubnetGroup'
Properties:
Description: cache
SubnetIds:
- Ref: SubnetA #5
- Ref: SubnetB
Cache:
Type: 'AWS::ElastiCache::CacheCluster' #6
Properties:
CacheNodeType: 'cache.t2.micro' #7
CacheSubnetGroupName: !Ref CacheSubnetGroup
Engine: redis #8
NumCacheNodes: 1 #9
VpcSecurityGroupIds:
- !Ref CacheSecurityGroup
Inspect the CloudFormation example to see CacheNodeType used as a required property of an ElastiCache cluster, alongside engine, node count, subnet, and security settings. section 11.1.1
