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.
- 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:
I’m seriously in love with AWS S3 + Route 53 + CloudFront static site hosting using Jekyll on the backend.— Pascal Finette (@pfinette) June 11, 2014
- Jekyll uses Ruby. Install with Ruby Gems.
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
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:
- 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.