Thursday, February 17, 2011

All Your Website Are Belong to S3

One of the most commonly requested features for S3 has been the ability to have it act more like a web server.  In other words, to be able to put an index.html file into a bucket and then point someone to that bucket and they see your website.  I found requests for this on the S3 forum dating back to June 2006.  I'm pretty sure if you search around in the forums long enough you will see posts from me predicting S3 would never have this feature.

Well, as is so often the case, I have been proven wrong.  AWS has just announced a new feature of S3 that lets you easily host static websites entirely on S3.  The features are pretty simple to use.  The basic process is:

  • Create a bucket to hold your website (or use an existing one)
  • Make sure the bucket is readable by the world
  • Upload your website content including the default page (usually index.html) and a optional page to display in case of errors
  • Configure your bucket for use as a website (using a new API call)
  • Access your website via the new hostname S3 provides for website viewing.  You can also create CNAME aliases, etc. to map the bucket name to your own domain name
The following Python code provides an example of all of the above steps.

I could now access my website using the following special link:

I could also use the CNAME aliasing features of S3 to map my S3 website to my own domain (which is probably what most people will want to do).  It's a great new feature for S3 and something that should prove useful to a lot of people.


  1. Nice feature, now we can host our sphinx docs in S3. Thinking about a make_s3 added to make_whatever in sphinx.

  2. True. I just moved an old static website over. It took about 10 minutes. I used the s3put command to copy the entire directory over to S3, configured the bucket and then set up a couple of DNS records. Very cool.

  3. Is Location.USWest a "must" or one can use "" ( connect_s3() without parameter ) and Location.DEFAULT instead?

  4. This should work with any location. I was just doing my initial testing in eu-west.

  5. I tried with connect_s3() and location.DEFAULT but is not working for me. If you where using connect_s3() (empty) do you use the location.DEFAULT?

    Or have you ever tried another zone?

  6. There are 4 different s3 endpoint for each bucket location. so you have to set proper s3 website endpoint for different bucket location.
    US :
    US West :
    EU :
    Asia Pacific :