What is Amazon DynamoDB?
Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability. It's designed for applications that need consistent, single-digit millisecond latency at any scale, making it ideal for mobile, web, gaming, ad tech, and serverless applications.
Unlike traditional databases that require server management, DynamoDB is serverless - you don't provision servers, apply patches, or manage infrastructure. It automatically scales up and down based on traffic patterns and provides built-in security, backup and restore, and in-memory caching.
DynamoDB Capacity Calculator
Capacity per Item: 1 RCU, 1 WCU
Cost Breakdown: $9.36 reads + $23.4 writes
DynamoDB Core Concepts
Partition Key
Primary key component that determines data distribution across partitions.
UserID: "user456" → Partition B
Even distribution for scalability
Sort Key
Optional component that sorts items within a partition.
user123#2024-01-01
user123#2024-01-02
Enables range queries
Global Secondary Index
Alternative partition and sort key for different query patterns.
GSI: Email + UserID
Query by email efficiently
Streams
Real-time change capture for triggering downstream processes.
→ Lambda function
→ Process change event
DynamoDB Data Modeling Patterns
Single Table Design
Store different entity types in one table using composite keys.
PK: USER#123, SK: ORDER#456 → User's order
PK: PRODUCT#789, SK: METADATA → Product info
GSI1PK: ORDER#456, GSI1SK: USER#123 → Order lookup
Adjacency List Pattern
Model many-to-many relationships using GSI projections.
PK: USER#alice, SK: FOLLOWS#bob
GSI1PK: USER#bob, GSI1SK: FOLLOWER#alice
Query: "Who does Alice follow?" or "Who follows Bob?"
Time Series Pattern
Efficiently store and query time-ordered data with TTL.
SK: 2024-01-15T10:30:00Z
TTL: 1708012800 # Auto-delete old data
Temperature: 23.5, Humidity: 65
Real-World DynamoDB Implementations
Lyft
Uses DynamoDB for real-time ride matching and driver location tracking.
- • Real-time driver location updates
- • Ride request and matching system
- • Fare calculation and billing
- • 1M+ updates per minute
Duolingo
Leverages DynamoDB for user progress tracking and personalized learning.
- • User lesson progress and streaks
- • Personalized learning recommendations
- • Leaderboard and social features
- • 500M+ users supported
Replit
Implements DynamoDB for collaborative coding environment state management.
- • Real-time collaborative editing
- • Project and file metadata storage
- • User authentication and sessions
- • Code execution history tracking
Samsung
Uses DynamoDB for IoT device management and smart home applications.
- • Smart device status and control
- • User preferences and automation rules
- • Device telemetry and analytics
- • Global device synchronization
Advanced DynamoDB Features
Performance Features
- • DAX (DynamoDB Accelerator) for microsecond latency
- • Auto Scaling for dynamic capacity adjustment
- • Parallel Scan for analytics workloads
- • Batch operations for efficiency
- • Eventually consistent and strongly consistent reads
- • Global Tables for multi-region replication
Operational Features
- • Point-in-time recovery (PITR)
- • On-demand backups and restore
- • Encryption at rest and in transit
- • VPC endpoints for secure access
- • CloudWatch integration for monitoring
- • IAM fine-grained access control
DynamoDB Best Practices
✅ Do
- • Design for uniform partition key distribution
- • Use single table design when possible
- • Implement exponential backoff for retries
- • Use projection expressions to limit data transfer
- • Enable point-in-time recovery for production
- • Monitor consumed capacity and throttling
❌ Don't
- • Use hot partition keys (sequential IDs, timestamps)
- • Store large attributes (>400KB limit)
- • Use scans for regular application queries
- • Create too many GSIs (limit of 20 per table)
- • Ignore burst capacity consumption patterns
- • Use DynamoDB for complex analytical queries