Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 741
RckMrkr Avatar asked Nov 13 '15 10:11

RckMrkr


2 Answers

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

like image 147
omuthu Avatar answered Sep 21 '22 14:09

omuthu


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

like image 26
James Flight Avatar answered Sep 19 '22 14:09

James Flight