Jay, trying to remember...

Steps to Jekyll hosting on S3 and CloudFront with SSL with Forestry.io Deployment

Here are the steps I went through to get a new / fresh blog up using Jekyll and deployed to Amazon S3 using Forestry.io with CloudFront and SSL.

Creating the Jekyll site

It’s probably best to follow the Jekyll quick start quide, but here’s basically what I went through…

Where the files will live

The site files will live in an Amazon Simple Storage Service bucket. This bucket will then be attached to Amazon CloudFront so that it can support SSL (as well as have global content distribution).

  1. Create a S3 bucket:
    • use the bucket name static.YOUR-DOMAIN.com - this will be where the non-CloudFront-ed content will live.
  2. Setup Static Web Hosting on the new bucket
    • index.html as index document
    • error.html as error document
  3. Set the bucket permissions under Permssions > Bucket Polciy add this:

         "Version": "2012-10-17",
         "Statement": [
                 "Sid": "PublicReadGetObject",
                 "Effect": "Allow",
                 "Principal": "*",
                 "Action": "s3:GetObject",
                 "Resource": "arn:aws:s3:::static.YOUR-DOMAIN.com/*"

Create an IAM user for S3 access

Setting up the domain

In Route 53 click Create Record Set and create an A - IPv4 address with a name of static and that is an alias to the static.YOUR-DOMAIN.com S3 bucket.

EASY: Using forestry.io to deploy

An easy way to now deploy the site is using forestry.io which is a tool to edit Jekyll (and Hugo) sites online. Behind the scenes you are just editing and commiting the post files to GitHub.

  1. Import the GitHub repo to forestry.io
  2. Under the Settings side menu, click on Deployment and select Amazon S3 filling in the correct bucket name (static.YOUR-DOMAIN.com) and the Access Key and Secret from the IAM CSV
  3. If all goes swimmingly, you should be able to make an edit using the forestry.io online editor and the site should get deployed to your S3 bucket. Which should be available at the domain name http://static.YOUR-DOMAIN.com

Create a SSL certificate

In Amazon Certificate Manager create an SSL certificate for your domains

This will take some time, so wait until it completes before moving on to the CloudFront step.

Setup CloudFront

Once the SSL certificate is issued you can create a new Amazon CloudFront distribution.

This should be all the settings you need to set. Click Create Distribution and wait until it deploys. This will also take some time.

Once deployed to CloudFront, you should be able to get the CloudFront Domain Name from your Distributions which will look something like xhja1sdfs7df.cloudfront.net. Copy this address for the next step

NOTE: Entering the static website value here should allow permalink: pretty in your config - so that you don’t need index.html at the end of links…

Update your DNS

In Route53

Next Steps

The deployment currently is getting handled by forestry.io which is all well and good, but better would be a deployment on check-in to GitHub - Forestry may be actually doing this, but a tool more focused on deployment such as CodeShip seems like a better idea. I may pursue this in the near (or distant) future.

comments powered by Disqus