1
votes

AWS DynamoDB provides streams which helps in capturing the table activity. To my understanding the flow of capturing changes in the dream is Stream ARN -> Shards -> shardIterator -> Records. In order for an application to monitor changes on a Dynamo table, it will have to keep on performing the above cycle. I was wondering if this flow can be simplified by hooks that can monitor those changes and trigger, which my application can listen to. I'm aware that there is a AWS Lambda integration which can perform the above cycle and alert, but I was wondering if it can be possible for an application to listen on AWS lambda alerts

The npm package dynamodb-stream does make it easier to consume the changes, but the polling mechanism doesn't seem to be the most efficient, if all table activity needs to be captured as fast as possible

1
"I was wondering if it can be possible for an application to listen on AWS lambda alerts" - what do you mean? A lambda function can make calls into an API end-point of your choice if that's what you meantMike Dinescu
@MikeDinescu Yes, I was looking for some reference to do thatAshwini Khare

1 Answers

1
votes

I'm not sure what the purpose of that npm package is, you can just use an event triggered Lambda with DynamoDB Streams. Basically, the Lambda service (not your individual lamb) will poll the Stream for changes and execute your lamb when it finds them. Much cleaner than using some kind of ridiculous timer based nonsense. Here are the docs on it.

Amazon DynamoDB is integrated with AWS Lambda so that you can create triggers—pieces of code that automatically respond to events in DynamoDB Streams. With triggers, you can build applications that react to data modifications in DynamoDB tables.

If you enable DynamoDB Streams on a table, you can associate the stream ARN with a Lambda function that you write. Immediately after an item in the table is modified, a new record appears in the table's stream. AWS Lambda polls the stream and invokes your Lambda function synchronously when it detects new stream records.