- Newest
- Most votes
- Most comments
You can set an S3 event to generate messages on an SQS queue. Then use that queue to drive a Lambda function that uses it as its event source, specifying a batch time window. See https://aws.amazon.com/about-aws/whats-new/2020/11/aws-lambda-now-supports-batch-windows-of-up-to-5-minutes-for-functions/ for more information.
I agree with the SQS queue approach as well, you can buffer the S3 event notifications inside SQS queue and call lambda from SQS. Then somewhere in lambda you need to check the list of the files uploaded vs expected list then call business logic whatever you have.
Hi,
The AWS Lambda function will be triggered for every object created in the Amazon S3 bucket. There is no capability to ask for the Lambda function to run only after 10 files (or any number) are uploaded.
You will need to add custom code to the Lambda function to determine whether it is 'ready' to trigger your work and the definition of 'ready' is up to you! Lambda trigger doesn't know your definition of ready. So, how could it wait for it?
Another way to go is the schedule the Lambda at regular time interval and have code in it to check if the files are to start working. If not, next schedule will do same until all files are here.
Best,
Didier
First line of your function could count the number of objects with a particular prefix (~ files in a folder) and if it's fewer than 10 then exit.
Relevant content
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago