JoeHack3r

Eat like a bird, and poop like an elephant --Japanese philosopher

Octopress CloudFormation Template

Usually one of the first things I do when experimenting or installing new software is determine the repeatable steps to get started. After this is done, I translate the steps for use in any number of tools to repeatably create a clean environment when needed. Two of my favorite tools for doing this are AWS CloudFormation and Ansible. Given Octopress’ usage pattern, I translated these steps to a CloudFormation template.

Some of my thoughts when creating this template were to use a “source” S3 bucket to store the source or markdown files for the blog and a “destination” S3 bucket to host the blog. I also wanted to make it easy to start and stop the instance so it is available only when needed which will help save costs. As such, the CloudFormation template is written to include permissions to read from a specific S3 bucket and write to another S3 bucket. It also places the Octopress instance in an Auto-Scaling Group. When creating the CloudFormation stack, I set the minimum size and desired size to 0 and the maximum size to 1. When I need an instance, I change the desired size to 1 and wait a couple minutes. When I’m done, I set the desired back to zero, the instance is terminated, and I’m billed for the hours the instance was running.

People may ask why not use your laptop or desktop for Octopress blogging. The answer is you can use your laptop and desktop for Octopress too. Personally, I do so much experimentation and changing of my local operating system, it is nice to have a clean environment available if and when I need it. AWS provides this for me for pennies an hour.

Many users may want to use GitHub to store their files. This can be accomodated by modifying the template accordingly. If you are interested in this or have other ideas, start a discussion about it and we’ll work on it together.

Happy blogging.

Comments