I’ve been working through the  AWS SDK for S3 trying to make sense of it. It’s definitely not straight forward and lacking some decent complete examples. Anyway, I’ve figured out how to upload an object to S3 using  Lambda and also using a  Node.js script and thought I would share it with all of you. Now that I can upload objects with  Lambda as per my other article  React.js API calls to AWS Lambda, API Gateway and dealing with CORS this also means I’m able to initiate this from  React.js via  API Gateway.

So let’s start from the beginning…

The first step is to create an S3 bucket in the  AWS Management Console. For the purpose of this tutorial I just created a temporary S3 bucket called “mediumtutorial” in EU (Ireland) region, also referred to as “eu-west-1”. Just select all the default options, by clicking NextNextNext and Create Bucket.

The next step is to open your S3 bucket, click on the Permissions tab, then CORS configuration.

#nodejs #s3 #aws #lambda #storage

Upload to AWS S3 using a Node.js Script or AWS Lambda
3.50 GEEK