If you need to let end users of your website or web application upload files, read on!
Using AWS, there is an easy way to use S3 and Lambda to handle file uploads in a totally scalable way. The solution doesn’t require any changes to your web application, only a little JavaScript added on your file upload page.
The code uses a NodeJS Lambda function to generate secure pre-signed URLs. You can PUT or POST a file directly to S3 using these URLs. There is some simple JavaScript which gets one of these URLs, and PUTs the file directly to S3 from the client browser. You can use this solution with a static HTML website, or a complex dynamic web application.
I have open sourced some code, and instructions on GitHub. So check it out here on GitHub: S3-Lambda-Uploader.
You can also ready a bit more about here on my Black Magic Consulting blog: Open Source AWS S3 Lambda Upload Example
Leave a Reply