Updated Nov 5, 20267 min read

What Is Amazon ElastiCache? Redis and Memcached on AWS Explained

Amazon ElastiCache is AWS's managed in-memory cache. How Valkey, Redis OSS and Memcached engines differ, node-based vs serverless, VPC access and Multi-AZ, and how to get a cache from application code.

Amazon ElastiCache is AWS's managed in-memory cache: you pick an engine, a sizing model and a network placement, and AWS runs the nodes, patching and failover. Backends use it for hot reads, sessions, rate limits and counters that should not hit Postgres on every request.

Creating a cluster in the console is quick, and the decisions that stick are the engine (Valkey, Redis OSS or Memcached), node-based versus serverless, Multi-AZ, and the fact that most setups are VPC-only, so local development needs its own Redis. This guide covers those choices and how Encore (infrastructure from code) provisions ElastiCache from a cache declared in code. For a wider comparison of managed Redis providers, see managed Redis in 2026.

Amazon ElastiCache at a glance

What ElastiCache doesWhat stays with you
HostingManaged Valkey, Redis OSS or MemcachedChoosing the engine and sizing model
SizingNode-based clusters or ServerlessInstance types and shard counts, or trusting Serverless scaling
AvailabilityMulti-AZ replicas with automatic failoverDeciding which environments need it
NetworkingRuns in your VPC (default)Subnets, security groups, local Redis for laptops
SecurityEncryption in transit and at rest, AUTH / ACLsWho may connect and which commands they may run
Data modelRedis structures or Memcached key-valueKey design, TTLs, eviction policy
PersistenceSnapshots / AOF options on Redis-compatible enginesWhether the cache can be flushed

How ElastiCache works

You create either a node-based cluster or an ElastiCache Serverless cache. Node-based clusters let you choose node type, shard count, replica count and placement across Availability Zones. ElastiCache Serverless creates a highly available cache quickly, scales memory and compute for you, and exposes a single endpoint so you do not size nodes by hand.

Clients connect with ordinary Redis or Memcached libraries. For Redis-compatible engines that means commands such as GET, SET, INCR and data structures such as hashes and sorted sets. Cluster mode shards keys across nodes when a single primary is not enough. Encryption in transit (TLS), encryption at rest and Redis ACLs are available on supported engine versions.

Engines: Valkey, Redis OSS and Memcached

Valkey is the Linux Foundation fork of Redis 7.2.4, created after Redis changed its license. It stays BSD-licensed and protocol-compatible, and AWS puts it first in current ElastiCache docs.

Redis OSS is the Redis-compatible engine line ElastiCache continues to offer for teams that standardize on Redis client behaviour and versions AWS supports.

Memcached is a multithreaded key-value cache. It has no Redis data structures, no built-in replication in the Redis sense, and a simpler operational model. Pick it when the workload is plain cache get/set and you already use Memcached clients.

For most new backend caches on AWS, Valkey or Redis OSS is the default. Memcached fits teams that already depend on it.

Node-based vs Serverless

Node-basedElastiCache Serverless
CapacityYou pick node type and countScales with usage
ControlAZ placement, cluster mode, patch windowsLess knobs, faster to create
Cost shapePay for reserved capacityPay for stored data and request units
When it fitsSteady load, fine-grained tuningSpiky or uncertain load, less ops

Node-based Multi-AZ deployments keep a primary and replicas in different Availability Zones and fail over automatically when the primary fails. You still choose capacity so the working set fits in memory. Serverless removes that capacity planning and still targets high availability; check current engine version support when you need a specific Redis feature.

Networking and Multi-AZ

Node-based clusters and VPC serverless caches sit in subnet groups inside your VPC. Security groups control which compute security groups may open port 6379 (or the Memcached port). There is no public endpoint on classic node-based setups, which keeps latency low from ECS or EKS and means a laptop cannot reach production without a tunnel or a separate local Redis.

Multi-AZ replication is the usual production setting for Redis-compatible caches that must survive an AZ loss. Snapshots cover warmer recovery; they do not replace designing for cache misses after a flush or failover.

Amazon MemoryDB is a related AWS service with a Multi-AZ transaction log for durable Redis-compatible primary data. Prefer ElastiCache when the workload is a cache in front of a database; prefer MemoryDB when Redis structures are the system of record.

What a hand-built setup involves

A typical ElastiCache setup for a backend has a subnet group across private subnets, a security group peering the service SG, a parameter group for maxmemory-policy, TLS and AUTH, IAM or secrets for the password, Terraform or CloudFormation for each environment, and a local Redis container because the cluster is not reachable from a developer laptop. Every new service that needs its own cache repeats that wiring.

How Encore provisions ElastiCache

Encore

Encore combines an open source infrastructure SDK for TypeScript and Go with a platform that provisions and deploys into your own AWS or GCP account. A cache declared in code becomes ElastiCache on AWS, starting on cache.m6g.large with Multi-AZ replication and Redis ACLs, or Memorystore for Redis in a high-availability setup on GCP, as documented in the AWS infrastructure docs and GCP infrastructure docs.

The Infrastructure page in the Encore dashboard with a database's configuration panel open, showing fields for vCPUs, memory, storage, availability type, max connections and backups.
Each provisioned resource can be reviewed and its configuration edited per environment in the Encore dashboard. The screenshot shows a GCP Cloud SQL database.

Set up the app

Get started
brew install encoredev/tap/encore &&
encore app create
Copy

Run in your terminal to get started locally.

~
$ encore app create api --example=ts/empty$ cd api && mkdir limits

A per-user rate limiter with typed keys and a 10-second window:

// limits/encore.service.ts import { Service } from "encore.dev/service"; export default new Service("limits");

The keyspace types both the key fields and the integer value, so two call sites cannot disagree on the shape under requests/:userId:

// limits/limits.ts import { api, APIError } from "encore.dev/api"; import { CacheCluster, IntKeyspace, expireIn } from "encore.dev/storage/cache"; // ElastiCache on AWS, Memorystore on GCP, an in-memory implementation locally. const cluster = new CacheCluster("rate-limit", { evictionPolicy: "allkeys-lru" }); const requestsPerUser = new IntKeyspace<{ userId: string }>(cluster, { keyPattern: "requests/:userId", defaultExpiry: expireIn(10 * 1000), }); export const ping = api( { expose: true, method: "GET", path: "/ping/:userId" }, async ({ userId }: { userId: string }): Promise<{ count: number }> => { const count = await requestsPerUser.increment({ userId }, 1); if (count > 10) { throw APIError.resourceExhausted("rate limit exceeded"); } return { count }; }, );

encore run uses a local, in-memory Redis implementation, so you can exercise the limiter on a laptop. It keeps only a small number of keys and purges them at random past that limit, so treat local counts as approximate. Keyspaces are covered in the TypeScript caching docs and the Go caching docs. Encore manages cache credentials, so no Redis URL or password is committed or shared. Connecting AWS is covered in deploying to your own cloud.

An AI coding agent adding a cache writes a keyspace declaration and tests it locally, and the ElastiCache cluster behind it arrives with the next deploy.

Best fit: TypeScript and Go teams on AWS who want a managed cache in their own VPC, declared in the code that reads and writes it.

Good to know

  • Set maxmemory-policy to match the use: allkeys-lru suits disposable cache entries; counters you cannot lose should not be evicted.
  • Plan for cache misses after failover or a flush; the database or upstream API remains the source of truth for cached data.
  • Keep rate-limit and session keys on a trusted identity, not a client-supplied header that any caller can rotate.

Frequently asked questions

What is Amazon ElastiCache used for?

Amazon ElastiCache is a managed in-memory data store on AWS. Backends use it for caching database query results, sessions, rate limits and short-lived counters, connecting with standard Redis or Memcached clients from services inside the VPC.

What engines does ElastiCache support?

ElastiCache runs Valkey, Redis OSS and Memcached. Valkey is the Linux Foundation fork of Redis 7.2.4 and stays protocol-compatible. Redis OSS covers Redis-compatible workloads on the open-source line AWS still offers. Memcached is a simpler key-value cache without Redis data structures or persistence.

Is ElastiCache reachable from the public internet?

Node-based clusters and VPC-connected serverless caches live in your VPC and are reached over private IP from ECS, EKS or EC2 in that network. ElastiCache Serverless can also be created with a public endpoint that requires IAM authentication and TLS, which is a separate choice at creation time.

How do I add an ElastiCache cache to a TypeScript API without Terraform?

With Encore, declare a cache with new CacheCluster() and a keyspace such as new IntKeyspace() from encore.dev/storage/cache, then call methods like increment(). An in-memory Redis implementation is used during local development, and deploying to AWS provisions ElastiCache with Multi-AZ replication.

Deploy to your cloud on AWS and Google Cloud
without managing infrastructure

Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.

~/orders — claude
Claude Code
Claude Code v2.1.180Opus 5.5~/orders