Search code examples
amazon-s3aws-lambdabatch-processing

Lambda function and triggered S3 events


I have a lambda function that gets triggered every time a file is written onto an S3 bucket. My understanding is that every time a single file gets in (this is a potential scenario, rather than having a batch of files being sent), an API call is fired up and that means that I am charged. My question is: can I batch multiple files so that each API calls will only be called if, for example, I have a batch of 10 files? Is this a good practice? I should not be in the position of having a processing time greater than 15 minutes, so the use of the lambda is still fine.

Thank you


Solution

  • You can use SQS to decouple this scenario, the lambda triggering point will be SQS, in there you can set batch size whatever you want.

    enter image description here