What a stream is
A DynamoDB Stream is a time ordered record of item level changes to a table. Whenever an item is created, updated, or deleted, a stream record is emitted.
View types
When you enable a stream you choose what each record contains.
- Keys only records just the key attributes of the changed item.
- New image records the item after the change.
- Old image records the item before the change.
- New and old images record both, useful for computing diffs.
Ordering and shards
Records are organized into shards, and records for the same partition key arrive in order. Consumers read shards and checkpoint their position.
- Records are retained for 24 hours.
- A common consumer is a Lambda function triggered on new records.
Common uses
- Replicating to another table or search index.
- Maintaining aggregations like counters.
- Powering global tables for multi region replication under the hood.
Diagram
Key idea
Streams turn table writes into an ordered change feed that consumers like Lambda use to replicate, aggregate, and react to data changes.