Skip to main content

Deploying Hugo to S3

·1 min
Table of Contents

Past Method #

When deploying a Jekyll blog, is was quite involved: Deploying Jekyll. Precious gems were used and a full development environment was required. If I’ve learned nothing else since then, it has been to simplify deployments as much as possible. The less coode the better.

Cardinal Rule of Deployments: They Always Go Wrong.

While CI is great when you have a multitude of projects and developers - having one for pet projects is just overkill.

Deploying Hugo to AWS is now a simple shell script!

Deploy Hugo #

#!/bin/bash
export S3_BUCKET=
# clean public build dir
rm -rf public
# rebuild site
hugo
# destructively sync with S3 bucket
# (anything not mirrored on the local filesystem will be deleted)
aws s3 sync public/ s3://$S3_BUCKET/ --delete

Gist