amazon-web-servicesamazon-snsaws-lambda

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?


Solution

  • Each SNS notification will contain not more than one message.

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

    Q: Will a notification contain more than one message? No, all notification messages will contain a single published message.

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