For years I had run a Wordpress based site and then after a fit of pique I shut it down a few years ago and migrated my domain to a static page on S3. Silence was golden for that period of time, however, I wanted to begin exploring some of the technologies out there and since I am close to 100% working only on an iPad I really wanted a very simple way to place my thoughts online.
In stepped Jekyll (not exactly simple, since I need to run a micro on AWS to manage the build and deploy) along with S3 for hosting, and Couldfront + AWS Certificate Manager for distribution and SSL, and of course Route 53 for the DNS glue (yes this is super tightly coupled AWS). There is some coordination involved with getting all the pieces working (and I’m not 100% convinced I’ve got it all working) so I’d like to sketch my steps here while I still remember.
- Jekyll, there’s a ton of resources out there on how to get started. I used Daniel Whyte’s guide.
- S3, Whyte’s post covered this for basic hosting on http, however, I wanted to make sure I could serve SSL which takes us to…
- AWS Certificate Manager is pretty straightforward. Generate a cert, allow it to create a Route 53 DNS record, and you are done. Really that easy.
- Cloudfront can do SSL termination, really dead simple to configure, just select the cert you created in Certificate Manager. Then all you need to do is configure a distribution that is backed by your site bucket. Now, this is were I was tripping over my feet for a little bit. When I first set it up and got things punched down on Route 53 I was throwing 403s. Turns out that you need to set an Alternate Domain Name (CName) that matches the domain you want to serve from in the distribution configuration. In this case I needed to put elwoodicious.com in there. It seemed counterintuitive when I was going through the process but with that dropped in Cloudwatch started forwarding appropriately to S3.
- Route 53, configure an A record with an alias to the distribution domain name. What’s interesting to note here is that googling for how to do this yielded “Use a CName!” and “Alias an A record”, which ok but when I when to go configure things my distribution didn’t show up all nice in the drop down like the s3 bucket did so I had to copy-paste. I opted for an A record like it was a traditional S3 configuration.
- The About section does not seem to be resolving the index.html transparently. I’m sure this is a configuration setting somewhere in S3/Cloudfront
- Invalidating the cache on deploy seems a bit wonky, I added my distribution ID to the s3_website.yml and that seems to help, however…