Create Amazon S3 Presigned Url using Serverless framework and NodeJS

In this hands on coding tutorial, we will discuss about Amazon S3 Presigned URLs and also implement and deploy a serverless solution on AWS to generate the same.

The following diagram illustrates the solution that we will create in the hands on coding.

When an Amazon S3 bucket is created, the bucket is private, meaning only the Bucket Owner has access to the bucket and it’s content. What if we need to share the content of the bucket with another another application or user who may or may not have IAM role. This is where S3 Presigned Url comes handy.

These Urls are generated using S3 APIs and are accessible for limited time (controlled by the expiry datetime we provide while generating). During that timeframe, user or application can access the private object in your S3 bucket.

In this tutorial, we will implement a serverless application using Node JS, that will expose an AWS Api Gateway end point, integrated with Lambda backend. The lambda code calls S3 APIs to generate the Presigned Url.

The source code for this tutorial is uploaded in github at https://github.com/mycloudtutorials/serverless-demos/tree/master/s3presignedurldemo

Please see the following hands-on video for this tutorial.