After migrating my blog from wp to octopress (see previous post), I started thinking that it might be a waste using a (shared) hosting account just to serve static files. Since I use Amazon Web Services a lot, I thought I might give Amazon S3 a shot.
There’s a zillion posts out there of how to make a static site in S3, including for octopress sites, so I won’t bother you with repeating the steps here (see the links in the end of the post).
There are two pitfalls worth repeating though:
You can’t point your bare domain to your S3 bucket, as it requires a CNAME record and not a A record.
This is mainly due to Amazons’ dynamic IPs (which is a good thing).
The only way to point to the static S3 site is with a subdomain, typically with ‘www’.
You might have a domain registrar which can mask the request to the bare domain to the ‘www’ subdomain, however I was not so lucky :(
I did however find a free service called wwwizer, which redirects your bare domain requests to the ‘www’ subdomain.
It’s a bit akward that this occurs on the http level and not at the DNS, but hey, it’s free and it works.
Syncing your site to S3
There are tons of ways you can sync the generated static site to S3.
There are two uploaders (regular and java app) at the aws console
Several browser extensions and desktop apps
A gem called jekyll-s3 which uploads the generated
This works great, but is hardcoded to use the
\_sitefolder, and you need to tweak octopress a bit to change it from
The annoying thing I saw was that it’s uploading assets that haven’t changed.
I forked the project and started hacking away on a option to pass the folder name to upload to s3.
A cli based client called s3cmd available via homebrew, apt etc.
This is an awesome client, which you can use to sync the generated site, uploading only the changed content.
I actually forked octopress and submitted a pull request with a deployment step using s3cmd, it was actually only after I submitted the pull request that I saw several other identical pull requests….
Links with explanations of how to host a static site on s3