Reputation: 690
Let's say I upload folder/key.jpg to a S3 bucket. How would I trigger a lambda function only when a file contains jpg at the end of File Name, is uploaded?
Is this possible or do I need to check the filename in the function and early-out it doesn't match what I'm looking for?
The reason I ask is that a lot of stuff will be uploaded to the bucket, and it seems inefficient (and costly) for the function to trigger every time.
Upvotes: 1
Views: 2064
Reputation: 21
It is possible to trigger lambda only on jpg image is uploaded in your s3 folder, follow https://n2ws.com/blog/aws-automation/lambda-function-s3-event-triggers. Just add jpg as suffix and foldername as prefix in event section of s3.
Upvotes: 2