isaranchuk
isaranchuk

Reputation: 382

Reliability of AWS SNS delivery to AWS Lambda

From AWS SNS FAQ page (Reliability section) I can see that SNS guarantees at-least-once message delivery to SQS, but it's not clear whether the same is applicable when notification is sent to Lambda.

So the question does SNS provide at-least-once message delivery when a message is sent to AWS Lambda?

Upvotes: 5

Views: 6135

Answers (3)

D S
D S

Reputation: 503

Q. What happens to Amazon SNS messages if the subscribing endpoint is not available?

Lambda: If Lambda is not available, SNS will retry 2 times at 1 seconds apart, then 10 times exponentially backing off from 1 seconds to 20 minutes and finally 38 times every 20 minutes for a total 50 attempts over more than 13 hours before the message is discarded from SNS.

https://aws.amazon.com/sns/faqs/

Upvotes: 7

ketan vijayvargiya
ketan vijayvargiya

Reputation: 5649

I think your question is: will a Lambda function, subscribed to an SNS topic, be invoked at least once or only once for any message?

If so, the answer is: at least once. The following part from the FAQs helps answer this, with emphasis mine:

Q: How many times will a subscriber receive each message?

Although most of the time each message will be delivered to your application exactly once, the distributed nature of Amazon SNS and transient network conditions could result in occasional, duplicate messages at the subscriber end. Developers should design their applications such that processing a message more than once does not create any errors or inconsistencies.

Upvotes: 2

Arafat Nalkhande
Arafat Nalkhande

Reputation: 11708

The same FAQ page states that

When a message is published to a topic, Amazon SNS will attempt to deliver notifications to all subscribers registered for that topic. Due to potential Internet issues or Email delivery restrictions, sometimes the notification may not successfully reach an HTTP or Email end-point. In the case of HTTP, an SNS Delivery Policy can be used to control the retry pattern (linear, geometric, exponential backoff), maximum and minimum retry delays, and other parameters. If it is critical that all published messages be successfully processed, developers should have notifications delivered to an SQS queue (in addition to notifications over other transports).

This applies to all Non-SQS subscribers

Upvotes: 3

Related Questions