A DynamoDB stream is an ordered flow of information about changes to ite,s in a DynamoDB table
Let’s say there is an existing table that is owned by an application #1. There is another application #2 that is interested in all changes to the data in the table. Application #2 can access the items in the table by using the Data plane API but the challenge is that app#2 will not be able to figure out changes made to data by app #1
This where streams can help.
By default streams are disabled, you need to enable streams. When stream is enabled on a table, under the covers DynamoDb service creates the log stream with an endpoint. An app can read the log stream using the stream endpoint and DDB stream APIs. As changes are made to items, Stream Records get written to the log stream.
DynamoDB supports 2 types of streams.
Shards in DynamoDB stream are collections of stream records.Each stream record represents a single data modification in the DynamoDB table to which the stream belongs. There is a 1-to-1 relationship between the shards and the partitions. In this illustration the table has 4 partions & hence there are 4 shards. When changes are made to items - the stream record is added to the shard corresponding to the partition in which the item resides e.g., when an item in partition-2 is updated an event record is written to shard#2
(Covered in details in a modeling exercise)
AWS Blog - Stream Fan out patterns