Reputation: 633
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?
Upvotes: 8
Views: 16112
Reputation: 129
I faced the same issue, The problem was with the function name itself. Try to check the value of the prefix to see if that matches perfectly with the resource.
If the resource is: resource/
and prefix is /test
then the actual folder path becomes: resource//test
just remove the '/' before test
and it should work fine.
Upvotes: 1
Reputation: 556
Currently Under S3 there is option to Send notifications to Amazon EventBridge for all events in this bucket. Turn on
Upvotes: -1
Reputation: 11
Faced similar issues and figured our that the folder names should not have spaces.
Upvotes: 0
Reputation: 141
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.
Upvotes: 3
Reputation: 1369
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.
Upvotes: 1
Reputation: 39156
Amazon S3 APIs such as PUT, POST, and COPY can create an object. Using these event types, you can enable notification when an object is created using a specific API, or you can use the s3:ObjectCreated:* event type to request notification regardless of the API that was used to create an object.
Case 1:
Other case:-
Upvotes: 3