← Back to Services

ElastiCache

Priority Tier 2 Domain 2: Design Resilient Architectures Domain 3: Design High-Performing Architectures Domain 4: Design Cost-Optimized Architectures

Amazon ElastiCache is a fully managed, in-memory caching service designed for ultra-fast data access with sub-millisecond latency. Its purpose is to offload primary databases, reduce latency, improve application performance, externalize user sessions, and convert applications to stateless ones. AWS handles provisioning, patching, monitoring, and backups for this service, which offers a 99.99% availability SLA (source_page 1, 4).

Learning Objectives

Core Concepts of Amazon ElastiCache

ElastiCache is a crucial AWS service for high-performance applications, providing in-memory data storage for rapid access.

Amazon ElastiCache is a fully managed, in-memory caching service designed for ultra-fast data access with sub-millisecond latency. It simplifies the process of setting up, managing, and scaling a distributed cache environment in the cloud. It is a key value store.
ElastiCache offloads primary databases to reduce latency and improve application performance. It externalizes user sessions and helps convert applications to stateless ones. It improves latency and throughput for read-heavy application workloads and enhances the performance of compute-intensive workloads. It also reduces the load on the database.
As a fully managed service, AWS handles provisioning, patching, monitoring, and backups. This makes it easy to deploy popular open-source in-memory data stores like Redis or Memcached and provides a simple API to manage the cache environment. Users can create and configure a cache cluster with just a few clicks and scale it up or down as needed.
ElastiCache offers a 99.99% availability SLA. It follows a pay-as-you-go pricing model with no upfront investment.
Technical Specs: 99.99% availability SLA
An ElastiCache shard is a collection of multiple nodes that make up a cluster. It also offers Multi-AZ capability.

ElastiCache Deployment Options

ElastiCache offers two primary deployment models to suit different workload needs and operational preferences.

Choose between fine-grained control or fully automated management.

Provisioned (Self-Designed)

This option provides fine-grained control over node type, size, and scaling strategy. Users can configure autoscaling policies.
control_level: Fine-grained control over node type, size, and scaling strategy
autoscaling_capability: Can configure autoscaling policies
Use Cases:
  • Workloads with predictable traffic patterns

Serverless

With Serverless ElastiCache, AWS handles all provisioning and scaling automatically. It instantly scales to meet demand without downtime.
control_level: AWS handles all provisioning and scaling automatically
scalability: Instantly scales to meet demand without downtime
Use Cases:
  • New, unpredictable workloads
  • When focusing on application development over infrastructure management

ElastiCache Engines: Redis vs. Memcached

comparison-table

Amazon ElastiCache supports two open-source engines, Redis and Memcached, each with distinct features and suitable for different use cases.

A direct comparison of Redis and Memcached capabilities.

Option Type Data Structures Persistence High Availability Multi-threading Max Key/Object Size Max Data Volume Command Set/Features Pub/Sub Capabilities Typical Use Cases
Redis Feature-rich, single-threaded cache engine, in-memory data structure store Supports complex data structures (strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperlogs, geospatial indexes with radius queries) Supports durable AOF persistence with snapshot backup/restore. Lost data can be recovered. Robust HA with Multi-AZ replication (up to five read replicas to offload read requests, auto-failover) Single-threaded Key/value size up to 512MB 3.5 TiB Very large command set available, advanced features for sorting and ranking data Supports publish and subscribe messaging abstraction (PUB/SUB channel notifications) Centralized session storage, game leaderboards, queues, pub/sub messaging, real-time analytics
Memcached Multi-threaded, simpler, designed for pure high-speed object caching, distributed memory object caching system Simple data types, string or object No persistence. Lost data cannot be recovered. No Multi-AZ (data distributed across nodes, simple scaling by adding nodes) Multi-threaded (advantageous for compute-intensive operations) String or object up to 1MB 4.7 TiB Simple interface to write and read objects as blobs using unique keys No Database caching, simple object caching, large nodes with multiple cores or threads, elasticity by adding/removing nodes, partitioning data across multiple shards

ElastiCache Use Cases and Caching Patterns

ElastiCache is used in various scenarios to enhance application performance and scalability, employing different caching patterns.

In this pattern, the application first checks ElastiCache for data. If the data is present (cache hit), it returns it directly. If not (cache miss), the application queries the primary database, writes the results to ElastiCache, and then returns the data to the user. This reduces database load and is ideal for read-heavy workloads, but carries a risk of stale data.
Stateful web applications struggle with horizontal scaling because session data (e.g., user logins, shopping cart contents) resides on specific backend nodes. Centralizing this session data in ElastiCache (Redis is recommended due to Multi-AZ and persistence features) makes web servers stateless, allowing independent scaling and increased resilience.
ElastiCache can also be used for real-time leaderboards (using Redis sorted sets), messaging queues, and user recommendations.
With Write Through, every write operation is executed on both the cache and the database simultaneously, keeping them perfectly in sync. However, this pattern can introduce more write latency.
TTL is required for stale data in both Lazy Loading and Write Through caching. For Memcached, the `set` command has an expire parameter (in seconds). For Redis, the `set` command uses `EX seconds` or `PX milliseconds` to specify expire time.

Updating Cache Strategies

ElastiCache can be updated through various mechanisms to ensure data freshness.

Database triggers (e.g., DynamoDB, mysql.lambda_async procedure, MongoDB) can be used to update ElastiCache via a Lambda function or an EC2 instance.
The application itself can be used to update ElastiCache directly.

ElastiCache Security Features

ElastiCache provides robust security features to protect data and control access within the AWS environment.

Clusters should be deployed within a Virtual Private Cloud (VPC) for network isolation. It is recommended to place ElastiCache instances inside private subnets.
Security Groups are used as virtual firewalls to control access to ElastiCache clusters.
ElastiCache supports encryption at rest, which is enabled by default. For Redis clusters, encryption in transit is also enabled by default. For encryption at rest, users can use a default KMS key or a customer-managed key.
Technical Specs: Encryption at rest (enabled by default); Encryption in transit (enabled by default for Redis clusters)
Redis clusters support two main authentication methods: IAM Authentication, which provides fine-grained role-based access control (available on Redis OSS 7+), and Redis AUTH, which is password or token-based authentication to prevent unauthorized access.
Technical Specs: IAM Authentication (Redis OSS 7+); Redis AUTH (password/token-based)

AWS Management Console Demonstration (ElastiCache) - Creating a Redis OSS Cluster

procedure

This section outlines the steps to create a node-based Redis OSS cluster using the AWS Management Console.

A step-by-step guide to setting up a Redis cluster, covering engine selection, cluster configuration, networking, security, and backup options.

Prerequisites

  • AWS Account
  • Basic IAM permissions to create ElastiCache resources
1

Access ElastiCache Console

💡 Initiates the service interaction.

2

Select Cache Engine

💡 Redis OSS Cache is recommended over Memcached for its features.

3

Choose Creation Method

💡 Select 'Cluster create' to review all available options, rather than 'easy create' or 'restore from backup'.

4

Configure Cluster Mode

💡 Disabled for demo (uses single AZ); enabling provides multiple AZs.

5

Provide Cluster Information

💡 Name and description for identification.

Name: CS ElastiCache demo
6

Set Location and Multi-AZ

💡 AWS Cloud for location. Multi-AZ is enabled by default with auto-failover for high availability.

7

Select Engine Version

💡 Latest recommended version (e.g., 7.1) for features like IAM/Redis AUTH.

Engine Version: 7.1
8

Choose Node Type and Number of Replicas

💡 Node type based on memory (RAM more critical than CPU for caches). Replicas (0-5) for read scaling and HA.

Node Type: cache.m5.large; Number of Replicas: 0-5
9

Configure Connectivity

💡 IPv4 is the default.

Connectivity: IPv4
10

Configure Subnet Group and VPC

💡 Create new or use existing subnet group, select existing VPC.

11

Set Availability Zone Placement

💡 No preference for demo; recommend matching production application AZ for production.

12

Configure Encryption

💡 Encryption at Rest and in Transit are enabled by default.

13

Set Access Control

💡 Choose Redis AUTH (default user access, user group ACL) or 'no access control' for simplicity in demo.

14

Configure Backup

💡 Automated backup (retention 1-35 days), specify backup and maintenance windows.

Automated backup (retention 1-35 days)
15

Enable Engine Logs (Optional)

💡 Option to enable logs like Slow Log for monitoring.

Engine Logs: Slow Log
16

Create Cluster

💡 Initiates the cluster provisioning. Note that ElastiCache incurs charges.

Exam Tips

Glossary

Lazy Loading (Cache-Aside)
A caching pattern where the application checks the cache first; if data is not present, it queries the primary database, writes the data to the cache, then returns it to the user.
Write Through
A caching pattern where every write operation is executed on both the cache and the database simultaneously, keeping them in sync.
Redis OSS Cache
The open-source version of Redis used by AWS for ElastiCache.
ElastiCache shard
A collection of multiple nodes that make up an ElastiCache cluster.
AOF persistence
Append Only File persistence, a durability option in Redis that logs every write operation received by the server.
TTL
Time To Live, a mechanism to set an expiry time for cached data to prevent it from becoming stale.

Key Takeaways

Content Sources

Introduction to Amazon ElastiCache Introduction to Amazon ElastiCache 07_AWS_Solutions_Architect_Associate_... ElasticCache Amazon EC2 Extracted: 2026-01-26 11:20:57.965775 Model: gemini-2.5-flash