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 SDK’s 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;



Sometimes I just want to create some static pages, but I was forced to use either CMS or things like wordpress.
Now I guess there is a solution which is also super reliable.
AWS is just amazing.
Posted by: expert | February 17, 2011 at 04:55 PM
The missing link is now just something like S3 which also runs PHP5.3 scripts. Imagine how awesome that would be. Deploy app code to "phpS3", deploy database to RDS and have a pure awesome web application stack. Pleeeeaaaase! :-)
Posted by: Joshua | February 17, 2011 at 05:42 PM
This is awsome!!
Just wondering will S3 enable gzip/deflate for static content delivery in the future? This will reduce the bandwidth/cost as well as speeding up site loading.
Posted by: Angus Li | February 17, 2011 at 05:47 PM
This is a great little a addition to AWS services. I don't see myself using it for any practical reason just yet, but I can already imagine a few pretty cool uses.
Posted by: Ed at Red Bridge | February 17, 2011 at 06:12 PM
I wonder if you can configure Wordpress to use S3?
Posted by: Peter Filias | February 17, 2011 at 06:14 PM
That is just awesome! I've been looking for this for a long time, but didn't expect it so soon. ;) Wonderful job guys!
@Peter: You can configure WordPress to use S3 to store the static data such as images, videos, attachments, etc. Just upload them on to your S3 bucket and link them to your WP powered blog/website. HTH. I hope you didn't mean to install WordPress on S3. ;-)
Posted by: Pothi | February 17, 2011 at 06:45 PM
@Peter - Wordpress needs something to process the php scripts and relies heavily on .htaccess rewrite rules - so you need at least a micro instance & apache for that but you can pull static images & videos, etc from S3 - we do it all the time... there are also ways to mount an S3 bucket so that apache can write to it directly (you can have apache read from it too but that defeats the purpose)- and provided it has the right security. See: http://LogicWizards.NET/mounting-an-s3-bucket-on-ubuntu-lucid/ for more info...
Posted by: Joe Negron ~ NYC | February 17, 2011 at 07:11 PM
I can imagine writing rich client-side applications in something like SproutCore (http://www.sproutcore.com/) or Cappuccino (http://cappuccino.org/), and hosting them purely in S3. Amazing how a seemingly simple feature enables so much.
Posted by: Mase | February 17, 2011 at 07:13 PM
This sounds like it will be great with static site generators like Jekyll https://github.com/mojombo/jekyll
Posted by: DD | February 17, 2011 at 08:19 PM
I've been working on a tool for creating websites on S3 (https://github.com/kylefox/kirby) and these additions are the final pieces I needed :)
One small thing -- is there a way to get the endpoint URL for a bucket through the API? Unless I've overlooked something, it doesn't look like this is currently possible.
Posted by: Kylefox | February 17, 2011 at 09:22 PM
Certainly great news. But there is a caveat...
It would seem that you still can't serve a site from root ("domain.com") in this fashion because a CNAME record cannot (or should not, because it breaks RFC) be applied to the root. You could certainly serve "www.domain.com" with s3 Website functionality, but "domain.com" would still need to point to a DNS "A" record.
So, if root domain is desired as the s3 Website address, it seems the only alternative would be to redirect all requests to "domain.com" to "www.domain.com". That means, still, a single point of failure for "domain.com", and a no go for sites that are established on search engines at the root level. Bummer.
I hope I'm wrong on this. Maybe there is an Amazon Route 53 solution, or something that I'm missing?
From RFC1034 section 3.6.2:
If a CNAME RR is present at a node, no other data should be present; this ensures that the data for a canonical name and its aliases cannot be different.
http://www.faqs.org/rfcs/rfc1034.html
Eric P
Posted by: Eric P | February 17, 2011 at 09:55 PM
Cool idea. However, there's still no way to serve a site that doesn't use a CNAME, right? For example, example.com. Something would have to redirect example.com to www.example.com, which would be a CNAME to S3. I'd love for someone to correct me if I'm wrong.
Posted by: Edward Dale | February 17, 2011 at 11:56 PM
Bummer! It has just been days that I put my blog http://inside.glnetworks.de behind CloudFront but could not use S3 as the origin without the now provided default directory object feature. Thanks for adding this feature! If I may: Configurable Redirects and/or Rewrites would be another great thing to have in either S3 or CloudFront.
Posted by: Klickmich | February 18, 2011 at 12:02 AM
This is a huge step and something we have been waiting for quite some time now. Two remaining questions:
Is this integrated with Cloudfront as well?
Can we expect SSL support (with own certificates like on the elastic loadbalancer) any time soon?
Posted by: Mennoabbink | February 18, 2011 at 01:24 AM
Will this also work for CloudFront to deliver whole websites via a CDN? Would love to see ESI added to CloudFront, then we'd have the ability to take advantage of epic speed (CloudFront), reliability (S3/CloudFront multiple locations) and flexibility (CloudFront ESI -> EC2 hosting the dynamic content).
Posted by: Ryan Townsend | February 18, 2011 at 01:37 AM
Finally! Awesome. I'm sure i'll use this for hosting microsites.
Posted by: john adams | February 18, 2011 at 01:44 AM
Sounds great. Thanks AWS!
Posted by: Niall | February 18, 2011 at 01:57 AM
Good news. I hope we get the A-NAME record thing soon, then this will be really useful.
Posted by: Martin | February 18, 2011 at 02:31 AM
Has anyone had any luck with setting up this new Static WebHosting feature for their site? I've set up an index.html in the root of my bucket and it is styled with a CSS file located in the '/css' subdirectory but I am struggling to get the CSS file to style the index page. Any thoughts?
Amazon adding the static hosting feature is great, but until they implement more support for server-side scripting such as PHP, the service seems limited to simple HTML sites from the 90's! Thank you AWS, but you can do better! Until then, I'll eagerly await further advancements with this service.
Posted by: Kyle | February 18, 2011 at 06:24 AM
I've been using Cloudfront and S3 to do this for a couple of months. Cloudfront felt like overkill to just set a default root object. Thanks AWS!
Posted by: Joel | February 18, 2011 at 06:34 AM
Seems to me this is presented as a bigger thing than it actually is. It allows your bucket to present a default page for the www address, and gives you a custom 404 page, and er.. that's it, isn't it? None of the approximately 120 sites I help maintain 100% static, so use seem very limited to me. It's a start, but on its own it's a long, long way from hosting a complete website in practical terms.
Posted by: Brian | February 18, 2011 at 07:19 AM
I can't use this until I can serve my root domain without redirection to "www". Can Amazon designate an IP address (or set of IP addresses) for S3 that I can point my root A record to?
Posted by: Luigi Montanez | February 18, 2011 at 08:33 AM
Amazon S3 combined with the Jekyll static site generator could be a formidable option for hosting static content. Think about all the potential static content we could use: Blogs, Microsites, Minimum Value Products (MVP).
Amazon S3 is thee standard for hosting webapp assets. This new feature to host static content is good added value. Now I'm really interested to see where the S3 platform is in 2-3 years. Congrats to Werner Vogels and the entire Amazon Web Services team.
Posted by: TVD | February 18, 2011 at 04:31 PM
It is great to see that AWS is more agile and come out of this feature. Going forward, AWS should be doing a lot of such need based tweaks in EC2, EBS, CloudFront too.
Malcik.
http://www.cloudmanifest.com/
Posted by: Committedexpert | February 19, 2011 at 04:32 AM
The latest snapshot build of Cyberduck allows website configuration for S3. Refer to http://trac.cyberduck.ch/wiki/help/en/howto/s3#WebsiteConfiguration
Posted by: David Kocher | February 19, 2011 at 06:52 AM
This seems pretty exciting and easy to use. So, I tried it out. Unfortunately, I ran into one small problem -- a problem that isn't Amazon's fault, but could be helped by Amazon.
My registrar has a fairly short limit on CNAME records. The typical website bucket endpoint is pretty long (e.g. s3-website-us-east-1.amazonaws.com). And you have to add to that _another_ entire subdomain and domain (e.g. s3.somehost.com.s3-website-us-east-1.amazonaws.com).
For regular bucket hosting, I can just point the CNAME to s3.amazonaws.com. So, I tried pointing to just the endpoint (s3-website-us-east-1.amazonaws.com). This fails for the website features, but still works for direct links to the content.
Are their shorter endpoint aliases? Or do I need to go complain to my registrar?
Thanks!
Posted by: Shane | February 19, 2011 at 07:57 AM
This is awesome. It will gut the costs of web site hosting. I actually tried it too and it is relatively straightforward to use. You just have to make sure that the S3 bucket name is the same as the fully qualified subdomain which points to it.
I wrote up more at my blog post at blog.cloud-apps-experts.com/2011/02/cloud-services-amazon-s3-static-web.html.
Posted by: Jay Godse | February 20, 2011 at 06:31 AM
Kyle, I had exactly the same problem until I applied a policy to my bucket giving anonymous users read access to all files inside. Using the policy generator in AWS can be a bear but it looks like BucketExplorer (Windows) and Cyberduck (Mac) let you set bucket permissions easily. Hope this helps.
Posted by: Andrew Neely | February 21, 2011 at 02:35 PM
@Shane - The CNAME can be up to 255 characters long including the .s3-website-ap-southeast-1.amazonaws.com part (40 chars long), so effectively you should be able to create a bucket name of up to 215 characters to prepend to it.
Go complain to your DNS hosting company, not the registrar. See section 3.3 of http://www.ietf.org/rfc/rfc1035.txt for more info.
Posted by: Waddles | February 21, 2011 at 11:46 PM
Would it be possible to add an S3 served static page to an existing load balancer, or does the S3 bucket need it's own unique DNS record?
Posted by: dbcn | February 23, 2011 at 01:13 PM
CloudBuddy Personal supports static website hosting via its S3 sites plug-in. Please refer this URL (http://cssinnovations.blogspot.com/2011/02/website-hosting-in-aws-s3-using-css.html) for more information.
Posted by: Ezhil Arasan B | February 24, 2011 at 04:54 AM
Any plans to support HTTPS? https://www.allthingsdistributed.com/
Posted by: rick | March 19, 2011 at 02:02 AM
Hi,
I tried two DNS managers and found it is simply not possible to add a CNAME to example.com. Any subdomain is all right, e.g. www.example.com or images.example.com could be CNAMEd to the website bucket. But not the root domain name.
I therefore wonder whether it is a solution to use an A record instead of CNAME. E.g. using a ping I found the IP address of the bucket and now example.com properly shows the website bucket. So it works.
BUT what I need to know - and cannot find such information anywhere - whether the IP address of the website bucket will stay the same forever, or will it be changing, in which case my websites would stop resolving.
Thanks!
Posted by: Tomáš Fülöpp | March 20, 2011 at 03:37 PM
Hi Tomáš, this is what is called the "Zone Apex" problem. It is a shortcoming of DNS. We are working on a solution.
Posted by: Jeff Barr | March 22, 2011 at 08:09 AM
CSS Corp recently come up with a service called Arecord.net. Currently under BETA. This service allows you to host your static website in S3, and solves the problem of DNS A-record. All you need to do is, register your email id & domain name with Arecord.net and the ip address to configure your DNS A-record will be emailed to you. Once you configure your root domain to the given IP address, Arecord.net will start redirecting any request comes in for your root domain (.com) to www..com.
This service is applicable for S3, CloudFront & ELB as well.
Check this out and provide your valuable feedback to us. Hope you will enjoy using our service Arecord.net
Website : http://arecord.net
Posted by: Ezhil Arasan B | April 13, 2011 at 06:55 AM
Hi there, this service is awesome, I have been using s3 since the early days when I had to do all the coding myself to get things back and forth.
I think I found a bug however. When using a custom domain with a CNAME redirection to a matching bucket name AND the target file name has a space in the name of the file, the response seems to always be 403. I have verified permissions are public.
For the same file accessed in either the website method or bucket name method, spaces are allowed.
Replacing the space with a _ worked perfectly and I can access the same file without changing any permissions. Thanks. I didnt really require spaces, but thought I should let you know.
p.s. this comment box seems to not allow single quotes or parentheses... but does not tell you that. Just gives an error.
Posted by: J.P. | January 17, 2012 at 04:32 PM