Did you know that you can navigate the posts by swiping left and right?

Continous deployment using AWS Amplify and Jekyll

20 Aug 2020 . category: tech . Comments
#howto #aws amplify #jekyll #cicd

Recently I decided it was long past time to refresh my personal website, so I had a look around for some options. What I wanted was to be able to automate the deployment, and have the site be as simple as possible to maintain and update.

Enter AWS Amplify Console. In AWS’ words - “AWS Amplify is a static web hosting service that accelerates your application release cycle by providing a simple CI/CD workflow for building and deploying static web applications.” It supports multiple frameworks and Jekyll is supported out of the box, making continuous deployment a breeze.

Jekyll is a fully featured static site generator. You give it text written in your favorite markup language and it uses layouts to create a static website.

The Workflow

Amplify Console Workflow

First I have created public hosted zone in Route53 and pointed the gharris.uk domain at that. Managing the resource records themselves will be unnecessary.

Connecting the repository is straightforward. I am using BitBucket for this site, and after authorising Amplify access to my BitBucket account I can pick the git repository and branch that I would like connected to this Amplify application:

Amplify connect repository

Jekyll Build Settings

Next, the build settings. AWS Amplify gives a usable build configuration right out of the box. I’m using a Jekyll plugin that isn’t included in the default image so I added a gem install, along with the environment variables required for Jekyll to run a production build:

Amplify build

The build YAML itself:


version: 1
frontend:
  phases:
    build:
      commands:
        - gem install jekyll jekyll-paginate
        - jekyll b
  artifacts:
    baseDirectory: _site
    files:
      - '**/*'
  cache:
    paths: []

Custom Domain + SSL

One final setting, and that is a custom domain. I’ve already created a Route53 public hosted zone for gharris.uk so all I have to do is add the custom domain in the Amplify console and i’m good to go:

Amplify custom domain

Continuous Deployment

Now, whenever there are changes to the master branch of my Jekyll site repository, AWS Amplify runs a build and automatically updates this very site:

Amplify cicd

Cost

So what does this cost? Not much! AWS Amplify seems to be priced reasonably. On the free tier you get:

  • 1000 build minutes per month
  • 5 GB stored per month
  • 15 GB served per month

Which is more than enough for a little personal site like this. Once you’re over free tier:

  • $0.01 per build minute
  • $0.023 per GB stored per month
  • $0.15 per GB served per month

Me