How do I troubleshoot issues with invoking a Lambda function with an Amazon S3 event notification using Systems Manager Automation?

Last updated: 2022-02-14

My Amazon Simple Storage Service (Amazon S3) event notification doesn't invoke my AWS Lambda function. Or, I receive an error when I try to create an Amazon S3 event notification to invoke my Lambda function. Can I use AWS Systems Manager Automation to troubleshoot Amazon S3 event notification issues with Lambda?

Short description

To troubleshoot issues when sending Amazon S3 event notifications to Lambda, use the AWSSupport-TroubleshootLambdaS3Event Systems Manager Automation runbook.

The runbook verifies if an event configuration exists for the Lambda function and Amazon S3 bucket parameter values that you enter. If an event configuration exists, then the runbook verifies that the configuration, resource policies, and permissions are correct. The runbook's output provides AWS Command Line Interface (AWS CLI) commands that allow you to add the required resource policies or permissions.

Note: If the Amazon S3 event notification is no longer needed, then it's a best practice to delete the event notification.

Resolution

1.    Open the AWS Systems Manager console.

2.    In the navigation pane, under Change Management, choose Automation.

3.    Choose Execute automation.

4.    In the Owned by Amazon tab, in the Automation document search box, enter and search for AWSSupport-TroubleshootLambdaS3Event.

5.    Select the check box in the upper right of the AWSSupport-TroubleshootLambdaS3Event card. Then, choose Next.

6.    In the Input parameters section, do the following:
For AutomationAssumeRole, enter an AWS Identity and Access Management (IAM) role for the runbook to assume that includes lambda:GetPolicy and s3:GetBucketNotification permissions.
For LambdaFunctionArn, enter the Lambda function's Amazon Resource Name (ARN).
For S3BucketName, enter the Amazon S3 bucket's name.

7.    Choose Execute.

Note: If the output suggests validating and configuring your Lambda function concurrency, see Asynchronous invocation and AWS Lambda Function scaling.