We’re planning to add a few updates in Lambda Function which has been set as the trigger for DynamoDB New item Events
DynamoDB –> DynamoDB Streams –> AWS Lambda
So while performing an update, we need to make sure no events should be received by lambda.
Are there any easy-to-implement methods to do this??
2
Answers
First of all why are you using EventBridge?
The path should be
DynamoDB -> DynamoDB Streams -> Lambda
.To ensure the Lambda only receives new items you can use a Lambda Event Filter
Option 1: Streams -> Lambda (with enable/disable)
DynamoDB Streams can send events directly to Lambda using the Event Source Mapping integration. An Event Source Mapping is an AWS-managed poller resource that pulls events for you. If you remove EventBridge from the equation and use an Event Source Mapping, you can pause the flow of messages to the Lambda consumer with its
enabled
property:The UpdateEventSourceMapping API sets the enabled property:
Option 2: Streams -> EventBridge -> Lambda (with archive and replay)
If you really need the EventBridge integration, you can temporarily disable the rule that triggers your Lambda, then use the EventBridge archive and replay functionality to catch up when ready. You take responsibility for determining which events need reprocessing. This will be easier if your application is idempotent.