Overview
Advanced DynamoDB features that can come up at the exam: DAX, Streams, Global Tables, TTL, backups (PITR) and S3 export/import. Basics are in 09-Amazon-DynamoDB.
DynamoDB Accelerator (DAX)
- Fully managed, highly available, seamless in-memory cache for DynamoDB.
- Solves read congestion by caching data. Gives microseconds latency for cached data.
- No application logic change: the DAX cluster is compatible with the existing DynamoDB APIs.
- Architecture: the application connects to a DAX cluster (a few cache nodes), which is connected to the DynamoDB table.
- Cache default TTL is 5 minutes (can be changed).
| DAX | ElastiCache |
|---|---|
| In front of DynamoDB. Good for individual object cache, query cache and scan cache | Good for storing aggregation results or a very big computation done on top of DynamoDB |
They are not drop-in replacements, they are complementary. Most of the time, caching on top of DynamoDB means DAX.
Microseconds latency for reads on DynamoDB -> DAX.
DAX in front of DynamoDB
Stream Processing
A stream of all modifications (create, update, delete) on a table.
Use cases:
- React to changes in real time (e.g. send a welcome email when a new user is added).
- Real-time usage analytics.
- Insert data into a derivative table.
- Cross-region replication.
- Invoke Lambda on changes.
| Option | Retention | Consumers | Processing |
|---|---|---|---|
| DynamoDB Streams | 24 hours | Limited number | Great with Lambda triggers. To read it yourself: DynamoDB Streams Kinesis Adapter (KCL) |
| Kinesis Data Streams | Up to 1 year | Much higher number | Lambda, Kinesis Data Analytics, Kinesis Data Firehose, Glue Streaming ETL, and so on |
Architecture
- Application does create/update/delete on the table, whose changes go to DynamoDB Streams or Kinesis Data Streams.
- Kinesis Data Streams -> Kinesis Data Firehose -> Amazon Redshift (analytics), Amazon S3 (archive), Amazon OpenSearch (indexing and search).
- DynamoDB Streams -> processing layer (KCL adapter on EC2 instances, or Lambda) -> SNS notifications, filtering/transformations into another DynamoDB table, or send data to OpenSearch.
- Not all possibilities are shown (e.g. EC2 reading from Kinesis Data Streams, Kinesis Data Analytics on top).
DynamoDB Streams vs Kinesis Data Streams
Global Tables
- A table replicated across multiple regions (e.g. us-east-1 and ap-southeast-2).
- Two-way, active-active replication: applications can read and write to the table in any region.
- Goal: low latency access in multiple regions.
- You must first enable DynamoDB Streams, the underlying infrastructure used to replicate across regions.
Global tables now also offer multi-Region strong consistency (MRSC, zero RPO). The default stays multi-Region eventual consistency (MREC), which is what the course describes. AWS source
Time To Live (TTL)
- Automatically delete items after an expiry timestamp.
- Example: table
SessionDatawith a last attributeExpTimeholding a timestamp. When the current Epoch timestamp passesExpTime, the item expires and is eventually deleted by a deletion process.
Use cases:
- Keep only the most current items.
- Meet regulatory obligations (e.g. delete data after two years).
- Web session handling: keep the user session in a central place such as DynamoDB for two hours, accessible from any application. If not renewed, it expires and leaves the table.
Web session storage with automatic expiry -> DynamoDB with TTL.
Backups and Disaster Recovery
| Option | Details |
|---|---|
| Continuous backups (PITR) | Optionally enabled. Restore to any time within the configured recovery period (1 to 35 days, default 35). A restore creates a new table |
| On-demand backups | Longer term. Retained until you delete them explicitly. No impact on performance or latency |
| AWS Backup | Better management: lifecycle policies, copy backups across regions for DR. A restore creates a new table |
The PITR recovery period is configurable from 1 to 35 days per table; 35 is the default. The course said a fixed last 35 days. AWS source
Integration with Amazon S3
Export to S3
- Requires PITR enabled.
- Export from any point in time within the PITR recovery period (1 to 35 days, default 35).
The export window follows the table's PITR recovery period (1 to 35 days). AWS source
- Does not affect read capacity or performance.
- Use cases: data analysis (e.g. with Amazon Athena), retaining snapshots for auditing, big ETL transformations before importing back into a new table.
- Formats: DynamoDB JSON or ION.
Import from S3
- Formats: CSV, JSON or ION, into a new table.
- Consumes no write capacity.
- Import errors are logged in CloudWatch Logs.
Questions & Answers
Q1: How do you get microseconds read latency on DynamoDB without changing the application?
Answer:
Put a DAX cluster in front of the table. It is compatible with the DynamoDB APIs. Default cache TTL is 5 minutes.
Q2: DAX or ElastiCache?
Answer:
DAX for individual objects, queries and scans on DynamoDB. ElastiCache for aggregation results or large computations. They are complementary.
Q3: DynamoDB Streams or Kinesis Data Streams?
Answer:
DynamoDB Streams: 24 hours retention, limited consumers, works with Lambda triggers. Kinesis Data Streams: up to 1 year retention, more consumers and processing options (Firehose, Data Analytics, Glue).
Q4: How do you get a multi-region, active-active DynamoDB?
Answer:
Global Tables. Enable DynamoDB Streams first, since replication uses it.
Q5: How do you expire session data automatically?
Answer:
Use TTL with an expiry attribute holding an Epoch timestamp.
Q6: What are the DynamoDB backup options?
Answer:
PITR (1 to 35 days, default 35, restore into a new table), on-demand backups (kept until deleted) and AWS Backup (lifecycle policies, cross-region copy).
The course said PITR is fixed at 35 days; it is now configurable per table. AWS source
Q7: How do you analyze DynamoDB data with Athena?
Answer:
Enable PITR, export to S3 (DynamoDB JSON or ION) without affecting table read capacity, then query with Athena.
Check yourself
Quiz
Flashcards
Click the card (or focus it), then use ← → to move and Space to flip.