Reacting to Table Changes with DynamoDB Streams
This lesson explains how DynamoDB Streams records every item change in order, so other systems can react to inserts, updates and deletes without changing the code that writes the data.
Learning outcomes
After completing this lesson, you will be able to:
- Describe how streams record changes.
- Identify typical uses such as search synchronisation.
- Choose between DynamoDB Streams and Kinesis Data Streams for DynamoDB.
How streams work
DynamoDB Streams records every change to the items in a table as an ordered sequence of change records for each item, kept for 24 hours. The stream's view type determines what each record contains: only the keys, the new version of the item, the old version, or both.
AWS Lambda consumes the stream through an event source mapping, invoking a function with batches of changes, so applications can react to data changes without polling the table.
The following diagram shows a stream feeding a Lambda function.

Typical uses
Streams support many event-driven uses. A Lambda function can keep an Amazon OpenSearch Service index synchronised with the table, so items become searchable as soon as they change. It can notify customers when an order's status changes, maintain aggregate counters or materialised views that would be expensive to calculate on demand, or archive items to Amazon S3 as TTL deletes them.
Uses of streams
Streams or Kinesis Data Streams for DynamoDB?
DynamoDB can publish every change to a table in two ways. DynamoDB Streams is built in: it keeps changes for 24 hours, presents each change once and in order for each item, and supports a small number of simultaneous readers. It is the usual trigger for Lambda functions that react to changes, such as sending a confirmation when an order is written.
Kinesis Data Streams for DynamoDB sends the changes to a Kinesis data stream instead, where they can be kept for up to 365 days and read by many consumers, including Amazon Data Firehose and Managed Service for Apache Flink, which suits analytics pipelines. The following table summarises the differences.
24hours
DynamoDB Streams retention
365days
Maximum retention in Kinesis Data Streams
Streams or Kinesis?
Keeping search in sync
Products are stored in DynamoDB, and customers search them in OpenSearch. The search index must reflect changes within seconds, without changing the code that writes products.
| Component | Role |
|---|---|
| DynamoDB Streams with new and old images | Records every insert, update and delete |
| Lambda event source mapping | Reads the stream and updates the OpenSearch index |
| On-failure destination | Captures records that repeatedly fail, so they do not block the stream |
A zero-ETL integration from DynamoDB to OpenSearch Service is an alternative that needs no function at all.
How long does DynamoDB Streams keep changes?
Show answer
24 hours. Kinesis Data Streams for DynamoDB keeps changes for up to 365 days and supports more consumers.
Exam Tips
Remember for the exam
- To react to item changes with Lambda, use DynamoDB Streams.
- To keep a search index in sync with a table, use DynamoDB Streams with Lambda.
- For longer retention and many consumers of table changes, use Kinesis Data Streams for DynamoDB.