Posted On: Jul 13, 2023

AWS Lambda can now detect and stop recursive loops in Lambda functions. Customers build event-driven applications using Lambda functions to process events from sources like Amazon SQS and Amazon SNS. However, in certain scenarios, due to resource misconfiguration or code defect, a processed event may be sent back to the same service or resource that invoked the Lambda function. This can cause an unintended recursive loop, and result in unintended usage and costs for customers. With this launch, Lambda will stop recursive invocations between Amazon SQS, AWS Lambda, and Amazon SNS after 16 recursive calls.

When a function sends an event to Amazon SQS or Amazon SNS using a supported AWS SDK version or higher, Lambda tracks the number of times a function has been invoked based on that event. If a function is invoked by the same triggering event more than 16 times, Lambda will stop the next invocation and sends the event to a Dead-Letter Queue or on-failure destination, if configured. Customers will also receive an AWS Health Dashboard notification with troubleshooting steps.

This feature is turned on by default, and is available in the following AWS Regions: Asia Pacific (Hong Kong, Jakarta, Osaka, Mumbai, Seoul, Singapore, Sydney, Tokyo), Africa (Cape Town), Canada (Central), Europe (Frankfurt, Ireland, London, Milan, Paris, Stockholm), South America (Sao Paulo), US East (Ohio, N.Virginia), US West (Oregon, N.California). To turn off the feature for your AWS Account, please contact AWS Support. For further information, please refer to our documentation or the launch blog post.