Is it possible to trigger AWS Lambda Function by Event Bridge with multiple events in payload?

Viewed 53

When we trigger an AWS Lambda function with an Event Bridge trigger, we typically get one event per lambda invocation.

But the payload to the Lambda function has an array of events (though usually with only one event in it). If there are multiple events one after the other, one Lambda instance is usually triggered for each event.

Is it possible that we will get multiple events in this array? In case of a burst of events, will I get multiple events in the same Lambda function? Or can I assume that each Lambda invocation will have exactly one event?

In my case, I have a burst of events at midnight, and all my calculations of Lambda timeout will go wrong if a single Lambda invocation gets more than one events to process.

1 Answers

Sadly, event batching is not supported in EventBridge, unless you implement it yourself. Instead you could consider using SQS in between, e.g.

EB----> SQS ---> Lambda

This will allow you to set batching in lambda to get more then one msg from the SQS.

Related