This website used to be hosted on an EC3 node using wordpress. I didn’t really maintain it and was getting tired of it going down because Wordpress and PHP are so vulnerable to hacks if not maintained regularly. Instead of moving to a dedicated wordpress host I thought I’d experiment with static site hosted on S3.

Motivation

  • S3 is cheap. A minimal EC2 node would cost $15 per month. The minimal cost to host static data on S3 with CloudFront is lower.
  • There’s good tools for generating static sites and posting to S3. I decided on Jekyll because I’d seen the Jykll + S3 + CloudFront combination mentioned before:

This website is built using Jekyll and deployed straight to S3 using s3_website and cloudfront.

Prerequisites

gem install jekyll

Then create the new project

# pooloferrors is the name of the site. It'll create a subdirectory with default layout
    jekyll new pooloferrors

The default directory layout and configuation of jekyll is straight-forward.

Publishing to S3

The s3_website is used the static site to S3. The script configured the S3 bucket so all files are publicly readable.

gem install s3_website
s3_website cf create

Set up the minimal config to include the AWS credentials with a role that can write to S3.

Publish the site with push:

s3_website push

Notes

  • Markdown is great, but also very restrictive if you want to get creative with the CSS. I haven’t used Textile but it seems to provide more layout options. I’m trying to focus on the content so I’ve stuck with markdown. Converting old wordpress blog posts to markdown was simple (but manual)
  • The datestamp within the front matter of posts is more important than the datestamp in the filename. They need to be accurate to the date, and these are the values referenced by post_ref.
  • The index.html and other files can be customised to support multi-site using the [Liquid Template[(http://www.rubydoc.info/gems/liquid) language. A simple of multisite example is Create a Multi Blog Site with Jekyll
  • The engine supports pagination, but the built-in paginator doesn’t understand filtering in the index files.

AWS Walkthrough