Skip to content

codecitizen/s3-file-uploader-sls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

S3 File Upload Serverless

AWS Lambda function to generate Pre-Signed PUT URLs for AWS S3, written in Clojure.

This repository is also the basis for my first Blogpost in the Series Serverless Quicktips.

Usage

curl $HOST/upload -X POST \
    -d "{\"fileName\": \"hello-world.txt\"}" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"

Response:

{
    "fileName": "hello-world.txt",
    "key": "79be4015-d3d8-43e2-8e90-ed9c84f41658.txt",
    "expires": 1546300799,
    "url": "https://..."
}

The expires attribute contains a UNIX timestamp, indicating when the URL will expire to work.

Configuration

Create a file called src/main/resourcey/config.edn (see the example file).

{:bucket "my-temporary-bucket"
 :region "us-east-1"
 :url-expirery-time 7200}
Attribute Type Comment
bucket AWS S3 Bucket Name The bucket to generate the Pre-Signd Upload URLs for.
region AWS Region ID ID of the region the bucket is placed in.
url-expirery-time Natural Number / Seconds The number of seconds a Pre-Signed URL will be valid. By default 1 hour.

About

AWS Lambda function to generate Pre-Signed PUT URLs for AWS S3, written in Clojure.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •