AWS Lambda function trigger on object creation in S3 does not work

Viewed 6644

I am doing an upload like this:

curl -v -X PUT -T "test.xml" -H "Host: my-bucket-upload.s3-eu-central-1.amazonaws.com" -H "Content-Type: application/xml" https://my-bucket-upload.s3-eu-central-1.amazonaws.com/test.xml

The file gets uploaded and I can see it in my S3 bucket.

The trick is, when I try to create a lambda function to be triggered on creation, it never gets invoked. If I upload the file using the S3 web interface, it works fine. What am I doing wrong? Is there any clear recipe on how to do it?

3 Answers

Check the prefix in bucket/properties. If there is a world like foo/, that means that only the objects inside the foo folder will trigger the evert to lambda.

Make sure the prefix you're adding contains safe special characters mentioned here. As per AWS documentation, some characters require special handling. Please be mindful of that.

Also, I noticed modifying the trigger on lambda page doesn't get applied until you delete the trigger and new one (even if it is same). Learned hard way. AWS does behaves weird sometime.

Related