liveBook · Manning

Amazon ElastiCache

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

Amazon ElastiCache is a managed in-memory caching service supporting engines such as Redis and Memcached.

Amazon ElastiCache is a managed in-memory caching service for Redis and Memcached. A caching layer can reduce response latency and lower pressure on a primary data store. section 11.7 section 1.6

Choose the engine according to the data and scaling features required:

  • Memcached provides a simple key-value store and can scale memory and throughput by adding shards. section 11.7
  • Redis supports richer structures such as sorted sets, making it suitable for sessions, leaderboards, and other application data. section 11.1.2 section 11.7
  • Cache entries commonly expire after a period, use a write-through strategy, or are evicted when the cache fills. section 11.7

Applications reach ElastiCache through a network path, usually from a virtual machine in the same VPC. IAM controls cluster administration, security groups control node traffic, and the engine controls data access. Redis supports token authentication or role-based access control; Memcached does not provide user authentication. Enable encryption in transit when authentication secrets are used. section 11.3 section 11.3.3

Store a session and build a leaderboard

After creating a minimal Redis cluster and connecting through an EC2 instance with Redis CLI, set a session with a 15-second expiry: SET session:gamer1 online EX 15. GET returns online before expiry and (nil) afterward. Add scores with ZADD highscore 100 gamer1 and read the ordered results with ZRANGE highscore -3 -1 WITHSCORES. Delete the CloudFormation stack when finished. section 11.1.2

A CloudFormation deployment can define a cache subnet group, a cache security group, and a Redis cache cluster, allowing only application instances to reach port 6379. A single node is a minimal configuration; additional nodes, read replicas, or sharding address availability, read capacity, or memory requirements. section 11.1.2 section 11.6

Figure 11.10 An ElastiCache decision tree to resolve performance issues

Use the performance decision tree to choose between a larger node, horizontal deployment, or data compression when CPU, memory, or network usage makes the cache a bottleneck. section 11.6

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

How deep it goes
Explains engines, access layers, deployment, testing, scaling, and performance remedies without detailing cache internals.
Examples
Uses gamer sessions, Redis sorted-set high scores, and a Discourse deployment backed by a single-node Redis cache.
What it assumes
Assumes basic familiarity with EC2, VPCs, security groups, IAM, and CloudFormation while demonstrating their cache-specific roles.
What you can do after
Operate a Redis cache with CLI commands, configure access through CloudFormation, and select scaling responses to performance bottlenecks.
How it connects
Connects Redis and Memcached with EC2, VPC, security groups, IAM, CloudFormation, CloudWatch, RDS, and MemoryDB.

Also explained in

Compare how 2 books explain Amazon ElastiCache →

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.