Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger a REST call after an Amazon S3 upload

I am envisioning this use case where I can upload a file to Amazon S3, and when that's completed, S3 can make a RESTful to an endpoint on my server that will then fetch the S3 file to be processed.

Is this something possible with S3? I don't see this in the S3 documentation

Thanks

like image 379
user1805458 Avatar asked Oct 17 '25 02:10

user1805458


1 Answers

Amazon S3 supports events. You can create events on create, write or delete type events but not on read events. For destinations of the events, you can select SNS, SQS or Lambda. Calling a REST endpoint is not supported.

For your use case, you can create a Lambda function that is invoked by S3 when a new file is copied to S3. Your Lambda function can then do what you want, for example, calling your REST endpoint.

This tutorial will show you step-by-step how to setup Lambda invoked by S3:

Tutorial: Using AWS Lambda with Amazon S3

There are lots of examples on the Internet. The above example is node (JavaScript) but many languages are supported: Python, C#, etc.

like image 146
John Hanley Avatar answered Oct 19 '25 20:10

John Hanley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!