Amazon DynamoDB – Overview

Amazon DynamoDB – Overview

Amazon DynamoDB is a fully managed NoSQL database service designed for single-digit millisecond performance at any scale. It's serverless, highly available, and supports key-value and document data models.


DynamoDB – Table Example

Table: Users

Partition Key Sort Key Name Email
UserID (PK) null John Doe john@example.com

Composite Key Table: Orders

Partition Key Sort Key Item Quantity
UserID OrderDate Laptop 1

✅ Access pattern:

Get all orders for a user:
SELECT * FROM Orders WHERE UserID = '123'

DynamoDB – Read/Write Capacity Modes

Mode Description
Provisioned You manually set Read/Write Capacity Units (RCUs/WCUs). Cost-effective for predictable workloads.
On-Demand Auto-scales instantly based on demand. Pay-per-request. Great for spiky/unpredictable traffic.

🧮 1 WCU = 1 write/sec (1 KB)
🧮 1 RCU = 1 strongly consistent read/sec (4 KB)


DynamoDB Accelerator (DAX)

DAX is a fully managed, in-memory cache for DynamoDB that reduces read latency from milliseconds to microseconds.

Feature Description
In-memory cache Optimizes read-heavy workloads
Write-through cache Writes go to DAX and DynamoDB
Fully managed No manual patching, scaling, or backup needed

DAX vs. ElastiCache

Feature DAX ElastiCache (Redis/Memcached)
Integrated with DynamoDB ✅ Yes ❌ No (you manage cache logic)
Write-through support ✅ Built-in ❌ Manual sync required
Use case Read-intensive DynamoDB Generic app-level caching

DynamoDB Streams

  • Captures item-level changes in DynamoDB tables
  • Retains up to 24 hours of change data
  • Used for:
    • Audit logs
    • Replication
    • Triggering Lambda functions

Each stream record contains:

  • INSERT, MODIFY, or REMOVE
  • Before/after image (if enabled)

DynamoDB – Stream Processing

  • Use AWS Lambda to process stream records
  • Serverless ETL, real-time analytics, cross-service workflows

Example:

  • User signs up → DynamoDB stream triggers Lambda → Sends welcome email or writes to another system


DynamoDB Global Tables

  • Multi-region, fully replicated DynamoDB tables
  • Active-active replication (read/write in all regions)
  • Helps with:
    • Disaster recovery
    • Global app performance
    • Data sovereignty

DynamoDB – Time To Live (TTL)

  • Automatically deletes expired items based on a timestamp attribute
  • Great for:
    • Session expiration
    • Temporary cache
    • Auto-purging old logs

✅ Reduces storage costs without manual deletion logic


DynamoDB – Backups for Disaster Recovery

Backup Type Description
On-Demand Backup Manual/full backup at any time
Point-in-Time Recovery (PITR) Continuous backups for last 35 days

🧩 Restore to any second in the last 35 days (PITR)


DynamoDB – Integration with Amazon S3

Use Cases:

  • Export data from DynamoDB to S3 for:
    • Analytics
    • Archival
    • Compliance

Tooling:

  • Export to S3 (native)
  • DynamoDB Streams + Lambda + S3
  • Glue ETL to transform and load into Data Lakes

Summary Table

Feature Purpose
Tables Store key-value / document data
Capacity Modes Provisioned vs. On-Demand
DAX Built-in, ultra-low-latency cache
Streams Capture and process data changes
Global Tables Multi-region active-active setup
TTL Auto-delete expired items
Backups PITR and on-demand recovery
S3 Integration Export for analytics or archive

 

Back to blog

Leave a comment