AWS News Blog
Host Your Static Website on Amazon S3
We’ve added some new features to Amazon S3 to make it even better at hosting static websites.
Customers have been hosting their images and video for their websites on Amazon S3 for a long time. However, it was not that easy to host your entire website on S3. Why? If a user enters a site address (www.example.com) and the CNAME in the site’s DNS record resolves to the root of an S3 bucket (www.example.com.s3.amazonaws.com), Amazon S3 would list the contents of the bucket in XML form. In order to work around this, customers would host their home page on an Amazon EC2 instance. This is no longer necessary.
You can now host an entire website on Amazon S3.
You can now configure and access any of your S3 buckets as a “website.” When a request is made to the root of your bucket configured as a website, Amazon S3 returns a root document. Not only that, if an error occurs your users receive an HTML error document instead of an XML error message. You can also provide your own error documents for use when a 4xx-class error occurs.
Here’s more detail on the new features…
Website Endpoints
To access this website functionality, Amazon S3 exposes a new website endpoint for each region (US Standard, US West, EU, or Asia Pacific). For example, s3-website-ap-southeast-1.amazonaws.com is the endpoint for the Asia Pacific Region. Existing buckets and endpoints continue to work the same way they always have.
Root and Index Documents
When you configure your bucket as a website, you can specify the index document you want returned for requests made to the root of your website or for any subdirectory. For example, a GET request made to the following URI (either direct or via a CNAME):
mywebsitedomain.s3-website-us-east-1.amazonaws.com/images/subdirectory/
Will return the following S3 object
mywebsitedomain.s3.amazonaws.com/images/subdirectory/index.html
Error Document
When you access a website-configured bucket through the new website endpoint, and an error occurs, Amazon S3 now returns a new HTML error page instead of the current XML error. Also, you can now specify your own custom error page when a 4XX error occurs.
You can use the S3 tab of the AWS Management Console to enable your bucket as a website.
The CloudBerry S3 Explorer includes support for this cool new feature:
The newest version of Bucket Explorer also supports website hosting:
And (added post-release) the S3 Browser also supports it:
Also added post-release, CloudBuddy Personal has added support, as described in this blog post:
The AWS Java, .NET, and PHP SDKs support this new feature; for more information, consult the Amazon S3 Developer Guide. As always, we also encourage developers of libraries and tools to add support for this as well. If you are such a developer, leave me a comment or send me some email (awseditor@amazon.com) once you are ready to go.
I’m pretty excited by this new feature and hope that you are too. I think that it will be pretty cool to see website owners simply and inexpensively gain world class performance by hosting their entire website on Amazon S3. In fact, Amazon CTO Werner Vogels is already doing this! Check out his post, New AWS feature: Run your website completely from Amazon S3, for more information.
— Jeff;