Fresh Paint: Updating my blog platform to Hugo on AWS S3 and Cloudfront
- 7 minutes read - 1440 wordsAfter a few years living on Wordpress, it’s time to take some more control over my blog platform. Moving to my own set up with Hugo and AWS wasn’t incredibly easy, but honestly afer a few quick steps, I mostly had it working again. Between S3, Cloudfront, and a little scripting duck tape, I am running my own stack for this blog which will scale better, be far easier to maintain, and hopefully will result in far less Russian spam to my email. Plus, I think you’ll agree it looks far nicer.
Do you agree? Let me know in the Disqus comments below, which I finally have working again.
For the last couple of years, I’ve been running my blog on my own with Wordpress. After a brief stint after launching the blog on Medium, I got tired of not controlling my audience and stack. I moved to Wordpress hosted on my own EC2 instance with some Route53 routing because I figured it would be easy enough to maintain on my own without being tied to another platform provider. By moving to Wordpress, I could control my own site and the community around it. Honestly, it was a great idea because the direction Medium has gone in the meantime hasn’t been great. Considering I had to pay for my own hosting, I rarely paid more than a few cents a month because of the simple architecture of the site. Plus, it provided me a good opportunity to learn more AWS services like Route53 and how to configure SSL as well as introducing me to LetsEncrypt. After a year of benefit from their great and simple service, I actually donated to support them.
In the past year, hosting my own website also enabled me to set up my own email domain on AWS WorkMail and take control back from Google. Rather than having them inspect every message for advertising and other products, I own my own domain and can take it wherever I want now. I’ve moved almost all of my subscriptions over now, and conduct all of my correspondance from my own domain. While WorkMail is certainly tied heavily to AWS, at least I have the option of moving it elsewhere if I ever desire, unlike Gmail. I was also able to establish a Signal Proxy server to enable communication on the encrypted secure messaging platform for those in countries where the default servers are blocked by government firewalls. During lockdowns in China and Iran, my proxy server stood up as an option for anyone looking to have secure communication beyond the snooping eye of those authoritarian regimes. If anyone reading this can benefit, please leave a comment or DM me @tylopoda on Twitter to get access.
Wordpress suited my blogging needs for a few years. The platform is easy to set up and incredibly extensible with the great plugins the community offers. I was able to add support for HTTPS, publish directly to Google AMP, Facebook, and Apple News without having to do a single extra thing. Establishing a subscription list and enabling comments were also simple. I never happened to get the theme exactly the way I wanted it, but that was mostly because I have no eye for design, not a failing of the platform.
However, as time went on, I found that Wordpress needed constant updates that often resulted in downtime or a completely broken blog. I got sick of updates that took hours or brought down the site for users, requiring me to rebuild from scratch. These were just infrequent enough that each time felt novel and I ended up having to recreate EC2 instances, new keypairs, and re-learn how to perform these restores. I got sick of it when the latest update required a full migration to the newer version of Wordpress rather than an in place upgrade. Since I’d be performing at least a full day’s work to do this migration off of an incredibly old version of PHP with numerous security risks, I decided that time would be better spent simply moving to an easier to maintain platform. From my days doing web development, I knew that there was no simpler platform than straight HTML. So I decided to migrate to Hugo, generating my site from simple markdown.
After a few years of running my blog, I knew what functionality I needed and what I really didn’t need. Most of my posts have nothing more than a few paragraphs of text and an image or two. Sure I’ve used image galleries and embedded media for Strava and Garmin, but I never need anything more intricate than that. I prefer to let the eloquence of words speak for themselves, though through the filter of my terrible writing. I certainly didn’t need all of the extensive intricate funcationality hidden within Wordpress that only comes along with the complexity. Keeping it simple means I can quickly publish and maintain my site without a ton of work behind the scenes.
To be honest, it’s been hard to keep up with writing for the blog recently. While we were in the middle of buying a house, selling our old one, and then moving, there wasn’t a ton of free time for writing. Three boys under the age of five kind of take up a lot of time as well. Work has also been pretty busy. And, during COVID, there isn’t a ton of new stuff happening, limiting the topics I can write about. For the first time in years since starting this blog, I wasn’t publishing on a daily basis. Stripping it down to the essentials means I can focus on simple writing and get back into the habit. Since I’m just writing in markdown now, I can even use a simple text editor while I author these posts.
I also love the clean, minimal themes that Hugo provides. Unlike managing content sidebars, numerous headers, links that I can’t figure out where they go, and numerous other features, I was able to set up the simple structure of this site in a day with Hugo. Publishing a new post is a little more complex in that I have to run a command line script to build and publish to S3, but it’s still the same amount of time as going through the draft and publish workflow of Wordpress.
The simple architecture I’ve built on now, Route53 going to a Cloudfront distribution backed by an s3 static hosting origin, means that this site is essentially infanitely scalable and available. I’m no longer tied to individual instances of Ec2 that I have to trade off cost versus scalability and availability. While I could have set up autoscaling groups and advanced load balancing, it never felt worth it for the limited traffic I get. Instead, I relied on a single EC2 instance vertically scaled to the peak load I expected. Now, Route53 simple routes requests to the Cloudfront distribution which caches pages and can load balance for me, though it’s hardly necessary since the origin is an S3 bucket with essentially infinite scaling as well. These services even come with default monitors and logging, so I can track the website performance and usage, and know immediately if there are any availability problems. Unless S3 or Cloudfront are down, and a huge portion of the rest of the internet would be down as well, I don’t need to worry about my site being unavailable for users.
I did experience some difficulty in setting up a few aspects of the site, but thankfully this configuration is common enough that a quick search was enough to find tutorials and documentation on how to set up a simple site. When I couldn’t get the post pages to work correctly, I found similar problems on StackOverflow and a simple solution to change the Cloudfront configuration which took mere minutes. This simple setup also meant that changes were easy to test and verify locally on my laptop with the local Hugo server and see exactly how the site would look. It was also super easy to browse several themes and make the site look like my own without having to spend hours on customizations.
Time will tell if this move was a smart one or not. I might get sick of publishing changes to the site from my laptop. I might run into problems with the configuration I wasn’t expecting. But at this point, I’m pretty sure I’ll find it works way better, allows me to spend more time writing and less time managing the setup, and maybe I’ll get back on a regular publishing schedule.