I'm moving away from DigitalOcean to static site hosting on AWS S3. Here is easyest way to upload files to S3.

There are several extensions for Middleman that do S3 sync, but they all lack some functionality. Worst thing is that all those extensions can be replaced with aws cli utility from Amazon:

$ pip install awscli

If you are on OS X and don't have pip, run sudo easy_install pip first. After installing awscli you can upload your site from Middleman's project directory:

$ aws s3 sync build s3://[your-bucket-name] --acl public-read --delete --cache-control "public, max-age=3600"

This will upload Middleman's build directory to your bucket. Changed files will be replaced, unchanged not. --delete will delete all files present on bucket and not present in your build directory. Cache with max-age of one hour is useful for CloudFront.

If you ever want to delete everything, you can do it with:

$ aws s3 rm s3://[your-bucket-name] --recursive
Share on: