My use case : From the spring-boot application, I am publishing a payload to AWS SNS, this SNS is triggering the Lambda function.
If the lambda function fails, is there any configuration available on AWS lambda where we can specify the number of retries and the duration after which each retry happens?
CodePudding user response:
Sadly, you can't control retry policies as explained in the docs:
With the exception of HTTP/S, you can't change Amazon SNS-defined delivery policies.
CodePudding user response:
https://docs.aws.amazon.com/sns/latest/dg/sns-message-delivery-retries.html specifies the retry policies for Lambda:
Immediate retry (no delay) phase | Pre-backoff phase | Backoff phase | Post-backoff phase | Total attempts |
---|---|---|---|---|
3 times, without delay | 2 times, 1 second apart | 10 times, with exponential backoff, from 1 second to 20 seconds | 100,000 times, 20 seconds apart | 100,015 times, over 23 days |
And also notes
With the exception of HTTP/S, you can't change Amazon SNS-defined delivery policies. Only HTTP/S supports custom policies. See Creating an HTTP/S delivery policy.
Therefore no, you cannot change the retry behaviour of SNS for Lambda invocations. What you can do is subscribe an SQS queue to SNS and then let you lambda get triggered by that queue. On SQS you can configure the retry behaviour to some extent: https://docs.aws.amazon.com/lambda/latest/operatorguide/sqs-retries.html .