My Move From Wordpress to Hugo and AWS
Just recently, I moved this very blog from using Wordpress hosted on a Digital Ocean droplet, to using Hugo hosted on AWS. I figured I’d share that process and kind of the thoughts behind the move. My goal is also to document some of this process in some future posts. This will just be an overview of my thought process of the move and how my writing process has changed.
Moving Off Wordpress
My decision to move off Wordpress came as a result of a few things. First, I wanted a bit more control on how assets were optimized. Wordpress does give some control for that kind of stuff but not to the level I was looking for. Second, I thought learning AWS and setting up a static site on it would be a new challenge. Especially with AWS skills becoming a hotter commodity. Lastly, it was going to be cheaper, which I expand on in a later section.
GitLab, S3, & Cloudfront
First, an overview of my new writing process. I host the project using a private
repo in GitLab. I chose Gitlab due to CI being included as part of the repo which
I can use to deploy the blog when I commit. I use two branches; dev, which
autodeploys to my dev site, and master which handles the site where you are
reading this article.
Once the GitLab CI builds the project, it then uses the AWS CLI to upload the compiled assets to an S3 bucket. This bucket has been setup to be a website using S3’s built in configuration. The last layer is CloudFront which is just the CDN so assets are distributed globally. When a deploy goes out, the build process invalidates CloudFront’s cache so any new changes will be visible on the site.
S3 and CloudFront are the main pieces which serve the website, but I also use Route 53 for domain DNS. I moved my domain over from 1&1 which was actually a simple process. Once the domain is in Route 53, I setup SSL through AWS Certificate Manager. Perk of using Certificate Manager is that SSL certificates are free.
Cost Savings
With my old setup, the domain was $12 a year which that cost didn’t change when moving to AWS. Hosting costs though dropped dramatically. Before I was just using a $5/month droplet in DigitalOcean. That monthly cost is static and doesn’t depend on how much traffic I got that month. Now, with my current blog traffic, my blog costs roughly $2.25/month but that can fluctuate based on traffic. I can also further tweak some settings, optimize static assets, and implement more aggresive caching which will get that cost even further down.
Goodbye Wordpress
Some parts of AWS are quite complicated, but for just hosting a static site, everything was simple and straightforward to understand. Being able to use GitLab’s CI tool for deploys was definitely key as figuring out an automated way to do that would have been a challenge.