Amazon MemoryDB for Redis
A Redis-compatible in-memory database that stores data durably in multi-AZ transaction logs while delivering microsecond read latency
Overview
Amazon MemoryDB for Redis is a fully managed in-memory database service that provides Redis-compatible APIs. Unlike ElastiCache for Redis, it persists writes to a multi-AZ transaction log before acknowledging them to the client, and strong consistency is preserved across primary failovers. It delivers microsecond read latency and single-digit millisecond write latency. It supports Redis data structures such as String, Hash, List, Set, Sorted Set, and Stream, and works with existing Redis client libraries as-is.
The Critical Difference from ElastiCache for Redis
MemoryDB is compatible with Valkey and Redis OSS and shares its APIs with ElastiCache for Redis, but their data durability models differ. ElastiCache is designed as a cache, and without its durability feature, data persistence is not guaranteed. Replication is asynchronous, so when a failover from the primary node to a replica occurs, writes since the last replication may be lost. Snapshot-based backups are available, but data between snapshots cannot be recovered. MemoryDB is designed as a database, with every write synchronously persisted to a multi-AZ transaction log. The developer guide states that strong consistency is preserved across primary failovers. This difference means MemoryDB can be used as a primary database. The traditional two-tier 'RDS + ElastiCache' architecture can potentially be consolidated into a single MemoryDB tier, and the developer guide notes that MemoryDB removes the need to separately manage both a cache and a durable database. ElastiCache for Valkey also supports durability, and the ElastiCache user guide describes two options for persisting writes to a Multi-AZ transactional log, synchronous and asynchronous. The same guide suggests considering ElastiCache with durability enabled for single-Region durable workloads and MemoryDB when multi-Region active-active replication is required (as of October 2026).
Usage Patterns as a Primary Database
Examples of using MemoryDB as a primary database include session stores, leaderboards, real-time inventory management, and shopping carts. These workloads require fast reads and writes, their data structures fit Redis data types well, and they demand data durability. For session stores, one option is to move session data previously stored in DynamoDB or RDS to MemoryDB. For leaderboards, Sorted Sets enable score updates and top-N retrieval in O(log N) time, with gaming leaderboards and e-commerce sales rankings as examples. That said, there are cases where MemoryDB is not the right fit. Workloads requiring complex queries (JOINs, aggregations, subqueries) are better served by relational databases. Also, for large data volumes, one design stores only hot data in MemoryDB and keeps cold data in DynamoDB or S3.
Cluster Design and Cost Optimization
MemoryDB clusters are composed of shards and replicas. The number of shards is determined by data volume and write throughput requirements, while the number of replicas per shard is determined by read throughput and availability requirements. Node types include db.r7g and db.r6g, and the developer guide lists the supported types (as of October 2026). When selecting memory size, account for memory overhead in addition to the data itself. For cost, Reserved Nodes provide a discounted rate in exchange for a usage commitment, and the prices are listed on the official pricing page. To reduce memory usage, approaches include compressing data on the application side before storing it or optimizing the data model. The Hash data type is more memory-efficient than individual String keys when the field count is small.
References (Official AWS Resources)
The primary sources for this page are the official AWS website and documentation. Check the official pages below for the latest specifications and pricing.
- Amazon ElastiCache official page
- Amazon DynamoDB official page
- Amazon RDS official page
- AWS Documentation (official)
If this page and the official documentation disagree, treat the official documentation as authoritative.