Hosting a jekyll blog on Amazon S3
** 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):
Install necessary packages:
$ apt-get install ruby-dev s3cmd
Configure s3cmd settings:
$ s3cmd –configure
$ gem install jekyll
Create a github hook and place under your repository hooks/post-receive:
#!/bin/sh GIT_REPO=$HOME/path/to/my/repo.git TDIR=
mktemp -dTMP_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://www.yourwebsite.com/ rm -rf $TDIR
Create the bucket ‘www.yourwebsite.com’ and set up as a website (I used the Amazon Web Console to do this)
CNAME ‘www’ under yourwebsite.com to www.yourwebsite.com.s3-website-eu-west-1.amazonaws.com (or similar - check the URL given by the Web Console).