github twitter linkedin email
Setting up a static blog on AWS
Jun 28, 2017
2 minutes read

AWS with Hugo

Using the ‘Host a static website’ solution on AWS works pretty well for most cases, having used things like Wordpress and Ghost in the past I decided to try out this new approach and actually start blogging properly again. Hugo is a static site generator, it turns markdown files into html pages; another alternative I could have used is Jekyll.

After running the ‘solution’ you get a nice landing page that looks something like this:

Default landing page

Originally the URL was the generated Cloudfront one so to set it to adampie.co.uk I had to use an ‘A - IPv4 address alias’ to point at Cloudfront. To get HTTPS working I made a few config changes to Cloudfront, I also had to add certs to the AWS Certificate Manager of which I used LetsEncrypt to generate.

I came across a problem where Cloudfront would throw an AccessDenied error when you browsed to a subfolder.

AccessDenied

Though by changing the ‘Origin Domain Name’ from pointing to the S3 bucket to the actual URL of the bucket it all ends up working correctly.

Cloudfront Config


Workflow

The workflow of creating a new post is really simple, push to GitHub then have Jenkins run Hugo and push to the S3 bucket.

Jenkins

Overall I actually really like this sleek method of blogging, there is just less hassle.


Back to posts