liveBook · Manning

Cache cluster

As explained in Amazon Web Services in Action, Third Edition: An in-depth guide to AWS

A cache cluster is a deployment of one or more coordinated cache nodes that provide in-memory data storage.

A cache cluster is one or more coordinated cache nodes that provide in-memory storage. In AWS, Amazon ElastiCache creates clusters using Redis or Memcached. The cluster sits between an application and its database, serving frequently read data with low latency and reducing database pressure. section 11.0 section 11.1.1

Game leaderboard

An online game can store player scores in a Redis sorted set, allowing the cache to sort and retrieve leaderboard entries quickly instead of repeatedly querying and sorting a relational database. Player profiles and other frequently read metadata can use the same in-memory layer. section 11.0

A minimal ElastiCache cluster specifies an engine, cache node type, node count, subnet group, and VPC security groups. Nodes use private IP addresses, so testing normally requires an EC2 instance in the same VPC. Security groups control network access; IAM controls cluster-management actions, while Redis can additionally provide user authentication and authorization. section 11.1.1 section 11.3.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

Use the minimal CloudFormation template to see the VPC parameters, cache subnet group, security group, and single-node Redis cluster assembled as deployable resources. section 11.1.1

How Amazon Web Services in Action, Third Edition: An in-depth guide to AWS covers it

How deep it goes
Defines cluster resources and networking, then applies them in single-node Redis deployments, without detailing cluster performance tuning.
Examples
Uses game leaderboards, player metadata, and Discourse’s Redis caching layer as concrete deployment examples.
What it assumes
Requires a VPC, subnets, subnet group, security groups, and an EC2 test instance for private-network access.
What you can do after
Operate a basic ElastiCache Redis cluster through CloudFormation and connect to it from an EC2 instance inside its VPC.
How it connects
Connects caching layers with Redis, Memcached, databases, VPCs, subnet groups, security groups, EC2, and IAM.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Amazon Web Services in Action, Third Edition: An in-depth guide to AWS. The section links point to the parts of the book it draws on.