Implications of the Amazon CloudFront default root object

Amazon recently announced that their CloudFront service now supports serving of an arbitrary object at the root URL of a CloudFront domain. This means that Amazon S3 users can now host entire static sites using only S3 and CloudFront.

I realised shortly after the announcement that a few of my sites, whilst being Rails projects, do not actually need to be. Camel Punch and andrewbruce.net, for instance, don’t serve any content that could not be made static. If at a later date I decide to use forms, for example, it would be pretty easy to have a separate domain handle the POST requests and redirect back to the static site.

However, CloudFront’s caching mechanism means that there is a roughly 1-hour delay in updating keys (and therefore URLs). This could be worked around with JavaScript: for example, a blog site might have posts that only update once per hour, but with comments that arrive faster. These comments might live on a domain that served dynamic content, or (in an extreme example) they could still live on S3 and be served through CloudFront, but just be listed using a dynamic server that spat out keys in Atom form. Perhaps S3’s built-in directory listing functionality could be used for this purpose.

Either way, it might not be long before we see blogging software, and other static-site generation software taking advantage of this new feature. It means that anyone can serve a static site with optimum efficiency regarding the client’s geographical location. In addition, it means that people maintaining sites that run ‘slow’ frameworks (like Rails) can happily publish content without fear of being overloaded.

2 thoughts on “Implications of the Amazon CloudFront default root object”

  1. Interesting development. Do you have a feel for where the sweet-spot would be in terms of price compared to hosting a static site on a cheap vps or shared hosting provider?

    With regards to JS-powered comments, that is something Disqus provide. I use them on my blog, and it works pretty well.

    1. It would only be a feel, but S3 and CloudFront are extremely cheap, especially for small stuff like HTML. The great thing about using S3 and CloudFront is that you don’t need to think about scaling if your site is static: Amazon do all of it for you.

      Plus, if your site becomes popular for one day, you only pay for that day’s popularity. This could also be a bad thing: would you prefer to pay for uptime or pay nothing and be denied service until the buzz dies down? :P

Comments are closed.