Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

AWS Trigger after 100 new files are added to s3

I want a trigger to start a glue job, once after 100 new files(new since the last trigger was fired) are added to s3. How can this be achieved?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You can add events for object creation in S3 buckets:

S3 buckets -> Properties -> Event notification

Now, this does an event for each object created. It cannot do every 100. So, to go around that, you can do the following:

  1. Create DynamoDB table which will use on-demand capacity mode. In that table, use just 1 object, that will have fields ID and count.
  2. Create a Lambda function that will be called on object creation from the S3 bucket. What you will do there is check the count in DynamoDB. If it’s less than 99, increase the count. If it’s 99, reset to 0 and trigger the glue job (since this addition would be 100).
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading