Skip to content

Latest commit

 

History

History

uploader

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

uploader

Serverless web application for uploading files to S3

Deploy with CloudFormation

Prerequisites: Node.js and AWS CLI installed

  • Create an AWS Account and IAM User with the AdministratorAccess AWS Managed Policy
  • Run aws configure to put store that user's credentials in ~/.aws/credentials
  • Create an S3 bucket for storing the Lambda code and store its name in a shell variable with:
    • export CODE_BUCKET=bucket
  • Create an S3 bucket for saving the uploaded files, store its name in shell variable:
    • export DEST_BUCKET=bucket
  • Npm install:
    • npm install
  • Build:
    • npm run build
  • Upload package to S3, transform the CloudFormation template:
    • npm run package
  • Deploy to CloudFormation:
    • npm run deploy

Deploy from the AWS Serverless Application Repository

  • Create the code and destination buckets
  • Hit "Deploy" from the application page

Use

  • Go to API Gateway in the AWS Console to find the invoke URL and open it in your browser.
  • Files you upload will be stored in the configured S3 bucket
  • Optionally, you can set up a custom domain

Links

Limitations

Uploads happen in a single post. The lambda invocation payload limit is 6 MB, and it gets transferred into lambda with base64 encoding, which adds 33% overhead, in addition to the rest of the payload. The expected maximum upload size is around 4 MB.

License

© 2017-2023 Evan Chiu. This project is available under the terms of the MIT license.