Integrating Amazon DynamoDB and Amazon ElastiCache by using read-through caching
Jason Hunter, Amazon Web Services (AWS)
November 2024 (document history)
This guide presents the key design points to consider when you add an Amazon ElastiCache caching layer in front of an Amazon DynamoDB database. It explains how to implement a client-side shim that adds read-through caching to DynamoDB calls without requiring significant code modification in the application. A reference implementation is provided in Python to demonstrate the internal details.
ElastiCache is a popular and robust caching service that provides an advanced set of features, including:
-
Valkey and Redis OSS compatibility
-
99.99 percent service-level agreement (SLA)
-
Availability in all AWS Regions
-
Support for the latest Amazon Elastic Compute Cloud (Amazon EC2) node types
-
In-place changing of the node type
-
Automatic failover
-
Automatic scaling
-
Data tiering
-
Global replication
-
Backup support
-
Reserved nodes
-
Compliance with System and Organization Controls (SOC) 1, 2, 3, and other standards
-
Cache invalidation
-
Serverless option
DynamoDB also offers DynamoDB Accelerator (DAX) as a DynamoDB-specific memory cache option. This guide is for readers who prefer to use ElastiCache instead.
In this guide:
Sample repository
For a Python-based reference implementation of the designs discussed in this guide,
see the GitHub DynamoDB ElastiCache Integration repository