DynamoDB Streams
We can track the changes of dynamodb using the dynamoDB streams. On create, delete or updated, when the dynamodb streams is being enabled we can run a lambda function and do necessary tasks.
When we use global dynamodb table and data is being replicated between multiple region, the dynamodb streams must be enabled.
StreamViewType
determines what information are written to the stream to this table. StreamViewTypes
are
KEYS_ONLY
: Only pass the modified key itemsNEW_IMAGE
: Pass the new valueOLD_IMAGE
: Pass the existing valueNEW_AND_OLD_IMAGES
: Pass both the new and old values
As stream source, if we make use of lambda, the lambda needs permission to read these stream. In this case, we can make use of a managed policy, AWSLambdaDynamoDBExecutionRole
.
DynamoDB Streams can be integrated with
- Lambda
- Kinesis data streams
- Kinsis client library applications
Others:
- Data retention period for the DynamoDB streams are 24 hours.
- DynamoDB streams are not effective for previous changes (before enabling streams)