For the last few months I have been wanting to move my blog from a self-hosted Wordpress site into my AWS account. I have been hesitant, mostly because of the costs that would be associated with doing it right. I could easily setup a single instance that has a full LAMP stack and migrate over, but that really would not be the proper way to do it. The proper way would be to build out an autoscaling group for the application servers and move the database to RDS, but the costs associated with that would end up being way more than I am currently paying. So I have been putting it off. Until last week.

I read a number of blogs on a regular basis, and while I was reading Werner Vogels All Things Distributed, I noticed a little tagline at the bottom of the site that said “Generated by Jekyll and served out of Amazon S3.” I knew you could serve static sites out of S3, but I had not heard of Jekyll before. My curiosity was aroused and I started to dig into it more.

Jekyll is a program that essentially transforms plain text into static websites and blogs. Getting into how Jekyll works is not the main intent of the article, but you can find out more from their website. You can build your own site from scratch by using Jekyll to generate a new directory layout, or you can go to Jekyllthemes.org and find one that somebody already created. I did the latter, and downloaded Pavel Makhov’s Jekyll Clean Dark theme because I liked the layout and then proceded to change it to something a little brighter. I created a GitHub repository for my theme and I checked everything in.

Once my theme was ready and some of my old blog posts were imported, it was time to build out AWS to be able to host it. There were two key things that I wanted to come out of this migration. The first was that it was build completely using automated tools. I did not want to hand create anything. The second was that the website would update whenever I committed a new post. I came across a number of posts that were extremely helpful in better understanding how Jekyll works and how to install it in S3, including this post from Alex Bilbie and this post from OctoPerf.

The result of the process was a cloudformation template that creates the S3 Buckets and policies, creates the necessary CodePipeline and CodeBuild components, creates the SSL certificate, CloudFront distributions, and the required Route53 Entries. The stack creation takes a little while to build everything out, especially the CloudFront distributions. Creation also pauses until the SSL certificate approvals are processed. AWS handles this by sending an email to the address on file at the registrar that you must go in and click approval for.

I am pretty excited with how everything has turned out. The site has a cleaner look, everything runs in SSL, everything was deployed through automation and I no longer have to worry about the security risks that come with running Wordpress, servers, or databases.