Hosting a static site on Amazon S3: ec2instances.info
Amazon added the ability to host static sites on S3 recently so to try it out I made a small site comparing the different types of EC2 instances: www.ec2instances.info. It’s not much of a site but it was the only thing in my ideas list that didn’t require some sort of database backend.
The setup was very simple:
- Buy the domain (name.com is so much nicer than GoDaddy by the way).
- Point domain’s nameservers at my slicehost account.
- Add a new DNS domain in slicehost and add a single CNAME record with a name of ‘www’ and data of ‘s3-website-us-east-1.amazonaws.com.’
- Install the latest Cyberduck (Mac). Windows users can use one of the tools here.
- Create a new S3 bucket called ‘www.ec2instances.info’ and configure it for static site hosting.
- Upload all my files and change their permissions to make them readable by everyone.
Updating the site is easy - just select the file in Cyberduck and click the ‘Edit’ icon in the toolbar (or hit ⌘K) and it will automatically upload the file whenever you save. If I needed a real deploy system it’d be pretty easy to whip up something with Fabric and Boto.
Overall it seems like a great way to host a static site on the cheap (~$1.50/year for this). The only real downside is that you can’t have your root domain hit the bucket because a CNAME must be used. This means that ec2instances.info does not resolve properly. More details here.
Note: I tried to use Amazon’s new Route 53 DNS service instead of my slicehost account but the configuration is still a bit more involved than I’d like. Hopefully they’ll add it to the AWS web console soon.