Databases
Caching and purpose-built databases
AWS's philosophy is purpose-built databases: use the database designed for each access pattern instead of forcing everything into one engine. Caching sits in front of all of them to make reads fast and cheap.
Amazon ElastiCache
Managed in-memory data stores: Redis OSS / Valkey and Memcached.
| Redis OSS / Valkey | Memcached | |
|---|---|---|
| Data structures | Rich (lists, sets, sorted sets, hashes, streams) | Simple key-value |
| Persistence and backups | Yes | No |
| Replication, Multi-AZ failover | Yes | No |
| Pub/sub, leaderboards, geospatial | Yes | No |
| Multi-threaded scaling | Cluster mode (sharding) | Yes, simple horizontal scaling |
| Pick when | Most cases: sessions, leaderboards, HA caches | Simple, ephemeral object caching |
ElastiCache also offers a serverless option that scales automatically. Amazon MemoryDB is a Redis/Valkey-compatible durable in-memory primary database (not just a cache).
Caching strategies
| Strategy | How | Trade-off |
|---|---|---|
| Lazy loading (cache-aside) | Read cache; on a miss, read DB and populate cache | Only requested data cached; first read slow; can be stale |
| Write-through | Write to cache whenever writing to DB | Cache always fresh; caches data that may never be read |
| TTL | Expire entries after a time | Balances freshness and hit rate — use with both |
Key idea
"Reduce database load for repeated reads" or "store user sessions for a stateless fleet" → ElastiCache. For DynamoDB specifically → DAX.
Other caching layers
- CloudFront — cache content at the edge.
- API Gateway caching — cache API responses (REST APIs).
- DAX — cache for DynamoDB.
- RDS read replicas — offload reads (not a cache, but similar effect).
Purpose-built databases
| Service | Type | Use cases |
|---|---|---|
| Amazon DocumentDB | Document (MongoDB-compatible) | Content management, catalogues, user profiles — "MongoDB workloads on a managed service" |
| Amazon Neptune | Graph | Social networks, fraud detection, recommendations, knowledge graphs — "relationships between entities" |
| Amazon Keyspaces | Wide-column (Cassandra-compatible), serverless | "Migrate Apache Cassandra without managing servers" |
| Amazon Timestream | Time series | IoT sensor data, DevOps metrics, industrial telemetry |
| Amazon Redshift | Data warehouse (columnar, massively parallel) | Analytics and BI over large structured datasets (see analytics) |
| Amazon OpenSearch Service | Search and log analytics | Full-text search, log analytics, observability |
| Amazon MemoryDB | Durable in-memory | Ultra-fast primary database |
| Amazon QLDB | Ledger (immutable, verifiable history) | Listed in the exam guide, but AWS has ended support for QLDB — know it as "cryptographically verifiable transaction log"; modern alternatives include Aurora PostgreSQL with audit tables |
Exam patterns
- "Leaderboard with real-time ranking" → ElastiCache for Redis/Valkey (sorted sets).
- "Stateless web tier must share login sessions" → ElastiCache (or DynamoDB).
- "Analyse connections between people, accounts and devices to detect fraud rings" → Neptune.
- "Store and query billions of sensor readings by time" → Timestream.
- "Existing MongoDB app, managed service, minimal changes" → DocumentDB.
- "Existing Cassandra app, serverless" → Keyspaces.