Turn DynamoDB Streams On or Off
# Turn DynamoDB Streams On or Off
You may need to use DynamoDB Stream to connect to services like and AWS Lambda. AWS allows you to turn on a DynamoDB Stream, set some parameters and then turn off the DynamoDB Stream. Commandeer easily facilitates this process and provides instantaneous insight into the process status.
# What you'll learn
You'll learn how to toggle your DynamoDB stream so you can start processing your data in real-time.
# What is DynamoDB Stream
DynamoDB stream is a stream of your DynamoDB data which you can connect to the services like AWS Lambda. The idea is that you can connect your data to another source and act on it as it comes in. An example of this pattern is saving an invite record in DynamoDB which fires off a Lambda to send an email invitation.
# Turning On DynamoDB Stream
In order to use the DynamoDB stream feature of your Dynamo table, you need to turn on your DynamoDB stream. Doing so is very simple using the Commandeer desktop app. Open Commandeer, navigate to your table under AWS -> Dynamo. Once you're on the Dynamo detail page, click on the off button and choose the stream view type.
DynamoDB table with the stream off
Choosing the stream view type
AWS offers the following stream view types:
- Keys Only - Only the key attributes of the modified item are written to the stream.
- New Image - The entire item, as it appears after it was modified, is written to the stream.
- Old Image - The entire item, as it appeared before it was modified, is written to the stream.
- New and Old Images - Both the new and the old item images of the item are written to the stream.
Once the stream view type is chosen, the stream is created and you'll see the steam ARN which you can use to connect your resources to it. Feel free to click on the eye icon to reveal the stream ARN or to copy it into the clipboard.
DynamoDB stream is on!
# Turning Off Dynamo Stream
If you no longer need the steam to be on, you can click on the "on button" to turn the stream off. The previously enabled stream ARN will no longer be available.
# Conclusion
In this tutorial, we learned about DynamoDB streams. It's a useful feature of DynamoDB allowing us to build event-driven architectures. We can write our data into DynamoDB, then have it fire off another event like a Lambda invocation to do some further processing with the data.