Number of retries in AWS Lambda

Viewed 1897

While setting AWS Lambda settings we have a retry count of 2 (max) by default.

enter image description here

But when I am adding DynamoDB Trigger to it, there is retry option of 10,000

enter image description here

So which settings is true. If exception occurs will the retry will be 10,000 times or 2 times. Can someone please guide me. Thanks!

2 Answers

What you are describing are two different things.

The first one (retries of 2) is for asynchronous invocation of lambda. This means that you (or some service) invokes lambda function and it does not wait for the results. In this case lambda service will try to invoke your function in the background 2 times, on condition that the original attempt fails.

The second one (retries of 10000) is for Event Source Mapping. This is a special process in the lambda service which monitors data sources (in this case DynamoDB stream) and invokes your function on your behalf. You are not involved in this process, except for setting up the mapping. In this case the event source mapping invokes your lambda synchronously. It will try doing this 10000 times in case of errors. This is a separate setting from the retry setting used for asynchronous invocations.

Hope this helps.

So which settings are true. If an exception occurs will the retry will be 10,000 times or 2 times.

Both retries have different purpose and meaning.

  1. Lambda retries mean your lambda function has been triggered and some error occurred while during the processing event so it will retry once more to process the same event.

enter image description here

  1. In this your lambda functioned is not triggered yet as the error occurred during pulling a stream from the event source.

enter image description here

Lambda reads items from the event source and triggers the function.

this retires isn't in the context of a function. once it pulls the event from the stream then it will trigger the lambda with desired stream event.

You can look into the below diagram for board picture that is the same example with kinesis stream enter image description here

You can read more this below

invocation-async

create-event-source-mapping

understand-your-lambda-event-retries

lambda-with-ddb-stream

Related