DynamoDB interview question · Most asked
What are DynamoDB Streams, and how are they used?
Summary
DynamoDB Streams is an ordered, time-ordered log of item-level changes (new image, old image, or both) retained for 24 hours. Lambda functions or other consumers read it to react to changes: update aggregates, sync search indexes, send notifications, replicate data, or implement an outbox.
Longer Answer
Ordering is guaranteed per item (per partition key, within a shard), not across the table. Delivery to Lambda is at least once, so consumers must be idempotent. Failed batches are retried and block the shard until they succeed or expire, so configure bisecting on error, maximum retry attempts and an on-failure destination (DLQ). Kinesis Data Streams for DynamoDB is an alternative with longer retention and more consumers.
Key Points
- 24-hour change log with images.
- Ordered per item, at-least-once.
- Idempotent consumers; DLQ for poison batches.
- Kinesis option for longer retention.
Deep dive: Node.js Serverless on AWS Lambda: DynamoDB Streams and poison records
More most-asked DynamoDB questions
- Explain partition keys, sort keys and the two kinds of primary key.
- How do conditional writes work, and how do you implement optimistic locking in DynamoDB?
- What is a hot partition, and how do you avoid one?
- How do you approach data modelling in DynamoDB, and how is it different from relational design?
- What is DynamoDB, and what workloads is it a good fit for?
- Global secondary index or local secondary index: what is the difference?
- Query or Scan: what is the difference, and why avoid Scan?
- DynamoDB or a relational database such as Aurora PostgreSQL: how do you decide?