When Lambda is invoked by SNS, will there always be just 1 record?

Amazon Web-ServicesAmazon SnsAws Lambda

Amazon Web-Services Problem Overview


When receiving events in Lambda from SNS the outer structure of the event will look somewhat like: { "Records": [...] }

In all the tutorials I have seen there has only ever been 1 record in the records field.

Is it safe to make the assumption that the "Records"-array will only ever contain 1 item?

Amazon Web-Services Solutions


Solution 1 - Amazon Web-Services

Each SNS notification will contain not more than one message.

Refer Reliability section in SNS FAQ : https://aws.amazon.com/sns/faqs/

Having said that, each lambda function trigger will have just a single record

Solution 2 - Amazon Web-Services

Just ran into the same thing, and for posterity, I think it is worth adding that in the official AWS tutorial, they rely on there being exactly one record:

https://docs.aws.amazon.com/lambda/latest/dg/with-sns-create-package.html

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRckMrkrView Question on Stackoverflow
Solution 1 - Amazon Web-ServicesomuthuView Answer on Stackoverflow
Solution 2 - Amazon Web-ServicesJames FlightView Answer on Stackoverflow