This article runs you through how I deployed this blog.
- The source code is hosted on GitHub
- CircleCI builds the site (HTML pages) using Hugo
- CircleCI deploys the site to an AWS S3 bucket
- AWS CloudFront is configured to serve the content of that S3 bucket with a free TLS certificate from ACM
Static Site Generator
A static site generator turns a set of documents into a static website (HTML pages). If you’re looking for one, this website lists them: StaticGen.
My generator of choice is Hugo.
I wrote another post on how to get started with Hugo:
I’m using the following components:
- ACM TLS certificate for my own domain name, validated using DNS records. This is used to provide HTTPS termination from the CloudFront distribution.
- S3 bucket with private ACL to host the files (the website HTML pages).
- CloudFront distribution pointing to that S3 bucket as origin.
This other article explains how I deployed them using Terraform:
I use CircleCI to build and deploy the site to the S3 bucket.
I’m using this Dockerfile to build an image that contains
hugo, in which my blog repository will be pulled by CircleCI:
Then I added this simple script to my blog repository:
A minimal CircleCI configuration like this one will execute the publish script when you commit to master:
Note that the CircleCI project must be configured with an AWS access key and secret key pair to be authorized to make the API calls to AWS using the AWS CLI.