AWS Lambda Now Supports Maximum Event Age and Maximum Retry Attempts for Asynchronous Invocations

Posted on: Nov 25, 2019

AWS Lambda now supports two new features to provide developers additional controls on how to process asynchronous invocations: Maximum Event Age and Maximum Retry Attempts. When you invoke a function asynchronously, Lambda sends the event to a queue. A separate process reads events from the queue and runs your function. These two new features provide ways to control how events are retried and how long they can remain in the queue.

Maximum Event Age

When a function returns an error before execution, Lambda returns the event to the queue and attempts to run the function again for up to 6 hours by default. With Maximum Event Age, you can configure the lifetime of an event in the queue from 60 seconds to 6 hours. This allows you to remove any unwanted events based on the event age.

Maximum Retry Attempts

When a function returns an error after execution, Lambda attempts to run it two more times by default. With Maximum Retry Attempts, you can customize the maximum number of retries from 0 to 2. This gives you the option to continue processing new events with fewer or no retries.

With these two features, events are discarded, or sent to a dead-letter queue and/or Lambda destinations when one of these two conditions is met: Retry Attempts reaches its maximum value, or Event Age reaches its maximum value.

You can get started with these two features via AWS Management Console, AWS CLI, AWS CloudFormation, or AWS SDK for Lambda. It can be used at no additional cost in all AWS Regions where AWS Lambda is available. For more information on where AWS Lambda is available, see the AWS Region table. To learn more, see Asynchronous Invocation in the AWS Lambda Developer Guide, and this blog post.