AWS Lambda - How to stop retries when there is a failure

前端 未结 9 1394
面向向阳花
面向向阳花 2020-12-05 06:49

I know that when a Lambda function fails (for example when there is a time out), it tries to run the function 3 more times again. Is there any way to avoid this behavior? I\

9条回答
  •  生来不讨喜
    2020-12-05 07:25

    EDITED: It's now possible to change the lambda settings to disable retries (see announcement)


    Original answer:

    There isn't a way to disable retry behavior of Lambda functions. I suggest two options to deal with that:

    1. Make your Lambda able to handle retry cases correctly. You can use context.AwsRequestId (or corresponding field) that will be the same when a Lambda is retried.
    2. Put your Lambda inside a state machine (using AWS Step Functions). You can only then disable retries. This blog post I've written gives a more general explanation.

提交回复
热议问题