Skip to content

d0ugui/aws-lambda-presigned-urls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aws-lambda-presigned-urls

This is a simple AWS Lambda function that generates a presigned URL for a file uploaded to S3.

Installation

Important

Be shure to follow the instructions bellow in the correct order.

Create S3 Bucket

Create a S3 bucket
Define the bucket name in the `src/index.js` file in line 24

Create lambda function

Create a lambda function
Zip this repository and upload it to your lambda function

Runtime settings

Update the handler path to `aws-lambda-presigned-urls/src/index.handler`

Generating URL

Make a POST request to your function url with the following body:

{
  "filename": "test.png"
}

The response will be a JSON object with the presigned URL

Policy & Upload file

Add S3 PutObject policy to your lambda function
Make a PUT request to URL generated in the previous with the file

Extra

Important

There is an example of how to access the uploaded file using getPresignedUrl in the src/getPresigned.js file.

About

A Lambda function code to upload files to S3 using the presigned URL approach.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published