Need to invoke lambda when record inserted to dynamoDB table,
But here i need to invoke lambda after 60 seconds of record insertion,
is there any way that invoke lambda after n seconds?
To solve this in a "scalable" manner I would use the following AWS products:
- DynamoDB Streams
- EventBridge
- Step Function
The process would look like this:
- As soon as your first Lambda inserts a new entry in your table, DynamoDB streams will be "triggered".
- You configure a Lambda to "listen" to the stream events.
- This Lambda should then put an event onto EventBridge. You do this instead of directly doing something here, because according to documentation, you should only have a maximum of two Lambdas "listening" on stream events. Therefore, I would recommend sending those "events" to EventBridge, so that you can add more/other processing steps to your DynamoDB streams. But this is optional.
- You create a rule in EventBridge that would trigger a Step Function with the appropriate payload (for example the DynamoDB keys you want to work on).
- The Step Function (as Artem described) could then contain a step that waits for n seconds, before another Lambda is triggered to run your code.