Posted On: Dec 16, 2019
We now support two new features on Amazon Lambda, which 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 event destination 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 Amazon Web Services Management Console, Amazon CLI, Amazon CloudFormation, or Amazon SDK for Lambda. It can be used at no additional cost in Amazon Web Services China (Beijing) Region, operated by Sinnet and Amazon Web Services China (Ningxia) Region, operated by NWCD. To learn more, see Asynchronous Invocation in the Amazon Lambda Developer Guide, and this blog post.