A new blog, using Hugo and AWS
So here we are, it’s 2020 and I’m starting a new blog. It’s not my first rodeo but I hope this one sticks. The initial goals to be are twofold:
- Exercise my writing, making it a part of my daily routine
- Learn some new technology in the process of deploying and maintaining it
If in the process I write something interesting, all the better, but I don’t aim for this to become too popular, but it won’t be a “dear diary” deal either. Today I won’t go into the various topics I intend to talk about. For that, you have my about page. Instead here I want to focus on the technology I’m using to build and deploy the blog: The Hugo static site generator, and AWS technologies, specifically (Route53, S3 and CloudFront).
Writing with Hugo⌗
If you want to have a static website but not worry too much about the technology behind the curtains, Hugo might be for you. It’s boring enough that once a basic setup is in place, you can focus on writing and things just work. You write posts as simple Markdown files, and the system turns them into static HTML that can be bundled and served however you like.
I say Hugo is boring in the best sense of the word. It’s boring like Django and jQuery are boring: It works well without requiring a ton of work, and there’s good documentation, a lively community and tons of themes to choose from. Case in point, I’m using the gorgeous terminal theme which simulates a computer terminal, because… well, just because.
To create a new post, you just run hugo new posts/the-post-name.md
and start typing away on your favorite editor (mine is VS Code). You can see your changes live by running hugo server -D
(or just hugo server
to omit drafts). When you are happy, run hugo
and a compiled version of the website will be created in folder public
, ready for deployment.
Deploying with AWS⌗
Once you have the first version of your website ready, it’s time to publish somewhere. For that, you need:
- A domain name (in my case, pablart.com)
- An account with some infrastructure provider (I chose AWS)
- 30 minutes
There are lots of easy tutorials on publishing a blog with Hugo and AWS, so I won’t go into too much detail, but I will highlight the 3 AWS services I use to run this website:
- Route53 for domain name registration and management
- S3 for document storage
- CloudFront for fast delivery via their CDN
You don’t have to use them all, as there are tons of alternatives (GoDaddy, CloudFlare, Akamai), but I like these because I’m familiar with AWS in general, it’s relatively affordable, and it’s easier to keep all things under one account, especially since this is a side project.
I recommend creating a simple deploy.sh
script with the details of the deployment process (upload changes, invalidate cache) so you don’t have to keep remembering them every time and can just focus on the writing part.
Now, let’s hope the habit sticks!