I have one Lambda it is executed on s3 put item trigger.

Now in s3 any objects uploaded lambda is triggering.. Let say Some one uploaded 5 files in s3 so each time it will execute the lambda for 5 files...

Is there any way that lambda can trigger only one time for all those 5 files...

Can I trace after complete of 5 time triggers/lambda execution...How many minutes lambda is not executing as no files uploaded..

Any help will really helpful for me

2 Answers

0
ubi On

If you have the bucket notification configured for object create (s3:ObjectCreated) and if you haven't specified a filter or filter satisfies the uploaded objects your lambda will get triggered each time for per uploaded object.

To see the number of invocations, you can look at the Invocations metric for your lambda function in Cloudwatch metrics

enter image description here

0
Ronyis On

You may want to add a queue that will handle the requests to process new files on S3.

A relevant one could be Kinesis data stream / SQS. If batching is important to you, Kinesis will be probably better.

The requests can be sent by a lambda triggered by S3 as you described, but it will only send the request to the queue, and another lambda will then process it. A simpler way will be to send the request in the same code that puts the object in S3 (if possible).

This way you can have statistics of how many requests were sent, processed, waiting, etc.