CodexBloom - Programming Q&A Platform

AWS Lambda Not Triggering on S3 Object Created Event Despite Correct Permissions and Configuration

👀 Views: 3 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-05
aws lambda s3 notifications javascript

I've been struggling with this for a few days now and could really use some help. I have configured an AWS Lambda function to be triggered by S3 when an object is created in a specific bucket, but it seems that the function is not being invoked at all. The Lambda function is set up with the correct permissions, as I have attached an execution role with the necessary policy that includes `s3:GetObject` and `s3:PutObject`. I verified the bucket event notifications and confirmed that they are set to trigger on `s3:ObjectCreated:*`. However, the Lambda function does not log any invocations. Here's the relevant IAM policy attached to my Lambda's execution role: ```json { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetObject", "s3:PutObject" ], "Resource": "arn:aws:s3:::my-bucket/*" } ] } ``` I also checked the S3 bucket notifications, which is configured like this: ```json { "LambdaFunctionConfigurations": [ { "Id": "MyLambdaTrigger", "LambdaFunctionArn": "arn:aws:lambda:us-east-1:123456789012:function:myLambdaFunction", "Events": ["s3:ObjectCreated:*"] } ] } ``` When I upload a file to the `my-bucket`, I do not see any logs in CloudWatch for the Lambda function. Additionally, I checked the S3 Event Notifications settings and confirmed that the Lambda function is correctly triggered on `s3:ObjectCreated:*` events. I also tried updating the S3 bucket policy to allow the Lambda function to invoke, but that did not help: ```json { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::123456789012:role/service-role/myLambdaRole" }, "Action": "s3:PutObject", "Resource": "arn:aws:s3:::my-bucket/*" } ] } ``` I have also confirmed that my Lambda function has the right permissions to access the S3 bucket directly, but it seems the event notification is not working as expected. What could I be missing? For context: I'm using Javascript on Windows. Am I missing something obvious?