I created a lambda function that is triggered using S3 PutObject event. My S3 bucket looks liks this:
s3://my-bucket-name/directory_1/...
s3://my-bucket-name/directory_2/...
s3://my-bucket-name/directory_3/...
Another application is creating folders like directory_1 and so on. Once data is created in this directory, the application also creates a file called _SUCCESS. so one of the directories look like this:
s3://my-bucket-name/directory_1/data.txt
s3://my-bucket-name/directory_1/_SUCCESS
Now I want to trigger my lambda function as soon as this _SUCCESS file is created. so I added a trigger of S3 in lambda as follows:
Event type: ObjectCreatedByPut
Bucket: my-bucket-name
Prefix: directory
Suffix: _SUCCESS
Currently, I'm able to see that lambda function is triggered properly whenever a new _SUCCESS file is created any directory. But I also want to know what is the exact key of the _SUCCESS file that triggered this function. How to do this?
For example, if s3://my-bucket-name/directory_1/_SUCCESS triggers my lambda, I should be able to get full path of this file inside this lambda function.
eventandcontext. If you printed those out you would have your answer. Note that you should trigger ons3:ObjectCreated:*. - jarmods3:ObjectCreated:*to request notification when an object is created regardless of the API used. - jarmod