New AWS feature: Run your website from Amazon S3

• 435 words

Since a few days ago this weblog serves 100% of its content directly out of the Amazon Simple Storage Service (S3) without the need for a web server to be involved.  Because my blog is almost completely static content I wanted to run in this very simple configuration since the launch of Amazon S3. It would allow the blog to be powered by the incredible scale and reliability of Amazon S3 with a minimum of effort from my side. I know of several other customers who had asked for this greatly simplifying feature as well. I had held out implementing an alternative to my simple blog server that had been running at a traditional hosting site for many years until this preferred simple solution became available: today marks that day and I couldn't be happier about it.

blog.PNG The Amazon S3 team launched a new feature today that makes serving a complete (static) web site out of Amazon S3 dead simple: you set a default document for buckets and subdirectories, which is most likely an index.html document. This enables Amazon S3 to know what document to serve if one isn't explicitly requested: for example http://www.allthingsdistributed.com returns the index.html at the bucket level and http://www.allthingsdistributed.com/2010/12/ the index.html from that subdirectory.  The other document you can specify is a customer error page that is presented to your customers when a 4XX class error occurs (e.g. non-existent page is requested), so they get something more appropriate than just the barebones response from the browser. Click on http://www.allthingsdistributed.com/doesnotexist.html if you want to see what this blog's error page looks like. The background is courtesy of @nalden.

All of this can be done from the AWS console as well as with the AWS SDK's.  You will also need to set access control to make sure that your content is publicly accessible. I have used a bucket policy to make all documents world readable, but you could create one that restricts it to referrers, network address range, time of day, etc. I can now turn on Amazon Cloudfront, the content delivery service, with one simple click, whenever needed.

There are a few small pieces of the blogging process that I still need a server for: editing postings, managing comments and to serve search and all of these can easily be run out of a single Amazon EC2 micro instance. [update: I have since removed these last two dependencies as well, see the next blog post].

Amazon S3 FTW! More details about the website feature of Amazon S3 can be found here and in Jeff Barr's blog post on the AWS developer blog.