Caching and Purpose-Built Databases: ElastiCache, MemoryDB, Redshift, DocumentDB, Neptune and Choosing the Right Database

AWS Solutions Architect 45 min min read Updated: Nov 17, 2026 Intermediate
Caching and Purpose-Built Databases: ElastiCache, MemoryDB, Redshift, DocumentDB, Neptune and Choosing the Right Database
Intermediate Topic 3 of 3

One Size Does Not Fit All

AWS offers purpose-built databases. Picking the right one is a core solutions architect skill. Think about data shape, access pattern, scale, latency and consistency.

Amazon ElastiCache

ElastiCache is a managed in-memory cache (Redis OSS / Valkey and Memcached). It sits in front of a database or serves as a fast data store, giving sub-millisecond reads and reducing load on the database.

Redis (Valkey) engineMemcached
Data typesStrings, hashes, lists, sets, sorted sets, streams, geospatialSimple key-value
PersistenceYes (snapshots, AOF)No
Replication and Multi-AZ failoverYes (replicas and automatic failover)No (data lost on node failure)
Backup and restoreYesNo
ShardingCluster mode (shards)Multi-threaded, scale by adding nodes
ExtrasPub/sub, Lua, transactions, Redis AUTH/TLS/IAM, leaderboardsSimple, very fast, easy horizontal scale
Quick choice: Need persistence, replication, complex types or leaderboards → Redis. Just a simple big cache with multi-threading → Memcached.

Caching Strategies

StrategyHowPros and cons
Lazy loading (cache-aside)App checks cache; on miss reads the DB and writes to cacheOnly requested data is cached; but first read is slow and data can be stale
Write-throughApp writes to cache and DB togetherData in cache is fresh; but wasted memory for data never read and slower writes
TTLExpire entries after a timeControls staleness. Combine with the others
python import json, redis r = redis.Redis(host="shop-cache.xxxx.cache.amazonaws.com", port=6379, ssl=True) def get_product(pid, db): key = f"product:{pid}" cached = r.get(key) if cached: # cache hit return json.loads(cached) row = db.fetch_product(pid) # cache miss: read the database r.setex(key, 300, json.dumps(row)) # store for 5 minutes (TTL) return row
  • Common uses: session store (keeps web servers stateless), leaderboards, rate limiting, database query caching, real-time analytics
  • Place in private subnets; security group allows only the app tier
  • Use replicas in multiple AZs with automatic failover for Redis; enable encryption in transit and at rest
  • ElastiCache Serverless removes node sizing

Amazon MemoryDB

  • A Redis-compatible, durable, primary in-memory database: data is stored in a multi-AZ transaction log, so it survives failures without a separate database
  • Use when you need microsecond reads and single-digit millisecond writes AND durability (not just a cache)

Amazon Redshift: Data Warehouse

Redshift is a managed columnar, massively parallel (MPP) data warehouse for analytics (OLAP) on terabytes to petabytes using standard SQL. Not for high-volume small transactions (OLTP).

FeatureDetails
ArchitectureLeader node plans queries; compute nodes store data in columns and run in parallel. RA3 nodes separate compute from managed storage
Redshift ServerlessNo clusters to manage; pay per use (RPU-seconds)
Redshift SpectrumQuery data in S3 directly without loading it
Concurrency scalingAdds capacity automatically for bursts of queries
Data sharingShare live data between clusters without copying
LoadingCOPY from S3 (fast, parallel), Kinesis Firehose, zero-ETL from Aurora/RDS, DMS
Availability and DRMulti-AZ (RA3), snapshots copied across Regions, automated snapshots
SecurityVPC, KMS encryption, IAM, column-level security, audit logging
sql COPY sales FROM 's3://acme-lake/sales/2026/11/' IAM_ROLE 'arn:aws:iam::123456789012:role/RedshiftCopy' FORMAT AS PARQUET; SELECT region, date_trunc('month', sale_date) AS month, SUM(amount) AS revenue FROM sales GROUP BY 1, 2 ORDER BY 2, 3 DESC;

Amazon DocumentDB, Neptune, Keyspaces, Timestream

ServiceTypeUse for
DocumentDB (MongoDB compatible)Document database. Storage replicated 6 ways across 3 AZs like AuroraJSON documents, content management, catalogs, MongoDB migrations
NeptuneGraph database (Gremlin, openCypher, SPARQL)Social networks, fraud detection, recommendation, knowledge graphs
Keyspaces (for Apache Cassandra)Wide-column, serverlessCassandra workloads without managing clusters
TimestreamTime-series databaseIoT sensor data, DevOps metrics, telemetry
Amazon OpenSearch ServiceSearch and log analytics engineFull-text search, log analytics, dashboards
QLDB (ledger)Immutable ledgerAWS has announced end of support for QLDB. Plan migration to Aurora PostgreSQL for new work. Check current status

Choosing a Database

RequirementPick
Relational, transactions, SQL joinsRDS / Aurora
Key-value or document at massive scale with millisecond latency, serverlessDynamoDB
Cache and sessions, leaderboardsElastiCache (Redis)
Durable in-memory primary databaseMemoryDB
Analytics on large structured data, BIRedshift
Ad hoc SQL on files in S3Athena
MongoDB workloadsDocumentDB
Relationships and graphsNeptune
Cassandra workloadsKeyspaces
Time-series metricsTimestream
Search and log analyticsOpenSearch
Global low-latency reads and quick regional failover (SQL)Aurora Global Database
Global multi-Region active-active (NoSQL)DynamoDB global tables

Practice Tasks

  1. Add a Redis cache to a sample app and measure response time before and after
  2. Explain why a cache with only lazy loading can return stale data and how TTL helps
  3. Create a Redshift Serverless namespace, load a CSV from S3 and run a query
  4. For six scenarios (chat sessions, product catalog, fraud graph, IoT temperatures, monthly BI, orders), choose a database and defend it
  5. Compare ElastiCache Redis and MemoryDB in two sentences

Conclusion

Use caching (ElastiCache Redis or Memcached, lazy loading plus TTL) to speed reads and relieve databases, MemoryDB for durable in-memory data, Redshift for analytics, DocumentDB for MongoDB workloads, Neptune for graphs, Timestream for time series, and always choose by data shape and access pattern.

Quick Summary: ElastiCache redis vs memcached; lazy loading/write-through/TTL; MemoryDB; Redshift MPP + Spectrum; DocumentDB/Neptune/Keyspaces/Timestream/OpenSearch; decision table.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators