Amazon DynamoDB is a managed NoSQL key-value and document store with single-digit millisecond latency at scale. You define tables with a partition key and optional sort key.
Core concepts
- Partition key — distributes data across partitions
- Sort key — optional; enables range queries on same partition
- On-demand vs provisioned — pay per request vs reserved capacity
- GSI/LSI — alternate query patterns (global/local secondary indexes)
When DynamoDB fits
- Session store, shopping carts, gaming leaderboards
- High write throughput key-value access
- Serverless apps with Lambda triggers on streams
Complex relational reports often stay on PostgreSQL or RDS.
List tables
aws dynamodb list-tables
aws dynamodb describe-table --table-name MyLearningTable \
--query 'Table.{Name:TableName,Status:TableStatus,Items:ItemCount}'Practice: Use RDS and DynamoDB free tier where eligible. Delete sandbox databases when finished—storage and instance hours can incur charges.
Hot partition awareness
Skewed partition keys (everyone writing the same key) throttle throughput—design keys that spread load (e.g. append suffix shards).
Important interview questions and answers
- Q: Partition key role?
A: Determines which partition stores the item—critical for even load distribution. - Q: DynamoDB vs RDS?
A: DynamoDB for massive scale key-value/document access; RDS for SQL joins and ACID relational models.
Self-check
- What is a partition key?
- Name one workload suited to DynamoDB.
Tip: Design partition keys for even write distribution—avoid one hot key for all users.
Interview prep
- Partition key?
Determines which storage partition holds the item—design for even load.
- vs RDS?
DynamoDB for massive key-value scale; RDS for relational SQL and joins.