Jekyll on AWS

2 minute read

Inspired by a former coworker’s site, I decided to spend a weekend to try to get a Jekyll generated site running on AWS. I’ve tinkered with Jekyll before, and really like the idea of editing everything in Markdown. I’m also attempting to do as much as possible directly from my iPad Pro.

Services

I went into this without knowing which AWS services I’d need, but quickly came across Calle Svensson’s excellent writeup. That led me to get set up with the following services.

Services Diagram

CodeCommit

A source control service for Git. Most people will use GitHub or GitLab, and I might migrate at some point, but the goal of the project was to use AWS services and this works fine for my basic purposes. The biggest lacking feature that would lead me to migrate is issue tracking.

Free Tier: 5 active users, unlimited repositories, 50 GB, 10,000 Git requests/month.

CodeBuild

A build service that gives you a configurable VM and allows you to run a build described by a build spec YAML file. There is a Ruby VM image which provided everything I needed to run Jekyll. It also includes the aws command to upload the build output to the S3 bucket and invalidate the CDN cache.

Watch out! The version of the bundler gem in the Ruby AMI isn’t compatible with the current version of the jekyll gem. In the Environment configuration, I added an environment variable: BUNDLER_VERSION = 2.0.1.

Watch out! The Jekyll theme I’m using requires some UTF-8 environment variables to be set.

Free Tier: 100 build minutes of build.general1.small per month.

CodePipeline

A continuous delivery service that watches for pushed changes to the master branch and triggers a build/deployment. It also supports GitHub triggers, but not GitLab.

Free Tier: Pipelines are free for first 30 days. Beyond that, one free active pipeline per month.

S3

A storage service for the generated site. The bucket doesn’t host the website directly, because HTTPS isn’t supported for custom domains.

Free Tier: 5GB, 20,000 GET requests, 2,000 PUT requests, 15GB data transfer out for one year.

Certificate Manager

A certificate service that proides SSL/TLS certificates for HTTPS traffic to a custom domain. Ownership of the domain is proven by creating a CNAME DNS record. Once it is verified by the service, the certificate is issued and can be used by CloudFront.

Free Tier: Public SSL/TLS certificates are free.

CloudFront

A content delivery network (CDN) service to serve the website from S3 storage. The primary benefit of CloudFront for me is to support HTTPS on a custom domain, but the regional cacheing is a nice benefit.

Free Tier: 50GB data transfer out and 2,000,000 HTTP & HTTPS requests per month for one year.

EC2

I’m trying to use an iPad Pro as my primary computing device, so I have an Ubuntu EC2 instance as a development environment. I’ve cloned the Git repo, run jekyll serve --watch --drafts, and use Vim to edit files. I have my SSH app split screened with Safari to see edits right away.

Watch out! By default, jekyll serve uses 127.0.0.1, which is only accessible from the same machine. Change the host to be 0.0.0.0 to allow viewing the site from other machines. I’ve done this in _config.yml but it can also be specified as a parameter to jekyll.

Free Tier: 750 hours of Linux t2.micro instances per month for one year.