Hosting a jekyll blog on Amazon S3

Share on:

** Note: I’ve replaced jekyll with the equally adapt pelican now. **

This article describes how to host your own static blog/site on S3. It revolves around the evolution this site has taken.

First off I started using github’s public site feature. Dead neat, nice set of features and so quick to get running. The problem is I’m impatient, and often after pushing an update the “Page build successful” can take upwards of 30 minutes. Not great for quickly fixing the inevitable typos!

This is a step-by-step on how to create a similar speedier homebrew setup with S3.

I’m assuming you host the git repository yourself - I have my repositories hosted on a home server. On this server (assuming Ubuntu here):

  1. Install necessary packages:

    $ apt-get install ruby-dev s3cmd

  2. Configure s3cmd settings:

    $ s3cmd –configure

  3. Install gems:

    $ gem install jekyll

  4. Create a github hook and place under your repository hooks/post-receive:

    #!/bin/sh GIT_REPO=$HOME/path/to/my/repo.git TDIR=mktemp -d TMP_GIT_CLONE=$TDIR/repo TMP_SITE=$TDIR/site/ git clone $GIT_REPO $TMP_GIT_CLONE jekyll –no-auto $TMP_GIT_CLONE $TMP_SITE s3cmd sync –delete-removed -P $TMP_SITE s3:// rm -rf $TDIR

  5. Create the bucket ‘’ and set up as a website (I used the Amazon Web Console to do this)

  6. CNAME ‘www’ under to (or similar - check the URL given by the Web Console).

  7. Voila!