DynamoDB Streams is a great feature that captures changes to a table at the point in time when the change happened, storing these changes in a log kept for 24hours.
This stream record is written with the primary key attributes of the items that were changed, ensuring that all modifications are recorded in the same sequence they occurred. It can also be configured to capture additional data such as the states before and after the change.
DynamoDB Streams writes in near to real-time allowing other applications to consume and take action on the stream records. Some good examples of use cases are:
- Aggregating metrics from multiple operations, i.e. buffering social media “likes” for a certain time period, aggregating the total value only once to save resources.
- A customer adds data into a DynamoDB table, which triggers an email confirming the additional data entry is correct.
- A mobile app has data that changes in a table, up to a thousand times a minute. Another application stores the details of these updates and provides real-time metrics, such as engagement, for the app.
It’s important to remember that AWS uses different endpoints for DynamoDB and DynamoDB Streams, however both must remain in the same region.