My AWS Lambda function keeps receiving more than one invocation request for a single event. How do I prevent my Lambda function from invoking multiple times from the same event?
To help prevent duplicate Lambda function invocations, do the following based on the invocation type that you're using.
Note: For synchronous invocations, the clients and AWS services that invoke a Lambda function are responsible for performing retries. For asynchronous invocations, Lambda automatically retries on error, with delays between retries.
Review your Lambda function's Amazon CloudWatch Logs to verify the following:
Then, do one of the following based on your use case:
For duplicate invocations that returned errors or timed out and that have the same request ID
Note: Duplicate invocations that return errors or timeout and that have the same request ID indicate that the Lambda service retried the function.
Configure error handling for asynchronous invocations to reduce the number of times that your Lambda function retries failed asynchronous invocation requests.
For more information, see Error handling and automatic retries in AWS Lambda.
For duplicate invocations that didn't return errors or timeout
Note: Duplicate invocations that don't return errors or timeout indicate client-side retries.
Note: Synchronous invocation retry behavior varies between AWS services, based on each service's event source mapping. For more information, see Event-driven invocation.
Viewing events with CloudTrail Event history
Best practices for working with AWS Lambda functions
Lambda function scaling
Why is my Lambda function retrying valid Amazon SQS messages and placing them in my dead-letter queue?