Upload static files & websites to Amazon S3 efficiently with s3up

s3up is a cross platform command line tool for uploading files to S3, optimised for statically generated websites.

Quick start

Grab a binary and put it on your PATH.

For example, on OS X you can do this via:-

curl -sfL https://github.com/matthew-andrews/s3up/releases/download/v1.0.5/s3up_darwin_386 -o /usr/local/bin/s3up && chmod +x /usr/local/bin/s3up

Or on Ubuntu (or in CI environments such as Circle CI) you can do this via:-

curl -sfL https://github.com/matthew-andrews/s3up/releases/download/v1.0.5/s3up_linux_386 -o /home/ubuntu/bin/s3up && chmod +x /home/ubuntu/bin/s3up

Afterwards, check that it has installed correctly by running:-

s3up --help

Features

  • Optimised for uploading static websites
  • Uploads multiple files concurrently (or can be set to upload one at a time — this can be controlled via the --concurrency option)
  • Only uploads files that are new or have changed
  • Automatically detects and sets an appropriate Content-Type for each file uploaded
  • Allows for easy configuration of ACLs and Cache-Control headers for files
  • Splits large files up and uploads them in smaller pieces
  • Written in Go and compiled for all platforms, which means it is fast, can be installed quickly, and is standalone — it does not rely on other dependencies (like Python or Node)
  • Allows manipulation of the path that files get uploaded to
  • Has a --dry-run so that the changes it will make to objects in S3 can be previewed

Manipulating upload path

When deploying a static website to S3 it’s useful to be able to upload files from a different local directory than the one you’re working in or to a directory other than the root in the S3 bucket.

With s3up, files can be uploaded into subdirectories via the --prefix option and leading components to be stripped off file names (for example a generated index.html in a dist folder can be uploaded to the root of an S3 bucket like this: s3up --strip 1 dist/index.html --bucket s3up-test)

I hope you like it and find it useful. Please report bugs if you find them.