Search This Blog

Loading...

Saturday, February 19, 2011

Cloud Services: Amazon S3: Static Web Sites

Amazon.com has just announced that they are going to allow people to host static web sites on Amazon S3.


Hosting static web sites at Amazon S3 will revolutionize static web sites, because it will cut the cost of hosting static web sites to almost nothing. The biggest beneficiaries will be web hosting companies and companies which build and operate web sites for their clients.

Let me show you. I used YSlow to analyze the static small business web sites of my friends Jeff, Samir, and Tyler. Here is what I got when I hit each home page once:

Now suppose that each site gets about 100 hits per day or 3000 hits per month, and a full site update is done once per month with all files changed. The traffic numbers become:
  • Bates Home Improvements - 54000 GET requests and 5.1 GBytes of outbound data transfer, and 1.7 MBytes of storage and the same for inbound data transfer.
  • Marmah Magnetics - 9000 GET requests and 17.1 MBytes of outbound data transfer, and 5.7 kBytes of storage and the same for inbound data transfer.
  • Ardoch Electric - 51000 GET requests and 804 MBytes of outbound data transfer, and 268 kBytes of storage and the same for inbound data transfer.
Now just plug those numbers into Amazon's S3 calculator and you get:
  • Bates Home Improvements - $0.69 per month.
  • Marmah Magnetics - $0.02 per month.
  • Ardoch Electric - $0.07 per month.
Bates' site  looks like it has the most expensive static web server. Now suppose that Jeff does a home improvement show on local TV every week, and instead of getting 3000 hits in a month, he gets 30000 hits per month. That means that storage and data transfer in stay the same, but GET requests and data transfer out go up by a factor of 10. (i.e. 540000 GET requests, 51 GBytes of  outgoing data transfer). According to the Amazon pricing calculator, his static web hosting cost goes to a whopping $8.11 per month.

Why are these low prices even possible? Because data storage has become super-cheap, servers have become super cheap, Amazon enjoys volume discounts, and because Amazon has standardized and massively automated their provisioning. All of this enables them to pass their savings to us.

Web sites hosted at Amazon S3 will revolutionize web site hosting. Why?
  • Web site operators for small static web sites can cut their hosting costs to the bone. 
  • If traffic grows for a static site hosted at S3, the web site operator doesn't have to do anything to scale the system, such as adding more servers, caching, network links, etc. A "massive" bump in traffic for a small web site is a mere blip on the traffic pattern of Amazon S3. They can handle it. Not having to worry about or do anything about scaling will reduce operations costs. 
  • Amazon S3 data is mirrored. That means even if disks or servers fail, you are very unlikely to lose your data. (You are more likely to lose data on your own server with a non-RAID disk). For a web site operator that means they spend less money replacing servers/disks and redeploying their static web sites. All costs of infrastructure maintenance and recovery are bundled in the price of the S3 service. 
  • Small traditional web hosts can gradually migrate their static hosting from their own servers or servers in a collocation centre to Amazon S3. This becomes useful especially when they have to dispose of old broken servers. As they do this, they will save a lot of costs for the acquisition, installation, configuration and commissioning of new servers. S3 has already done it. 
  • Web hosts of dynamic web sites could engineer the web sites so that S3 hosts and serves the static files of the web site while the dynamic content could be served through their servers. Overall that will mean that they will get more "bang" for their existing servers, because those servers won't have to serve up most static assets.
  • A lot of "long tail" web sites actually get very little traffic. There is no reason to deploy a ton of hardware and software just to serve that traffic. Amazon S3 provides this opportunity. Furthermore, web hosting companies don't have to engineer their servers to figure out the right mix of customers to put on their servers. Amazon S3 does for them.
Hosting web sites at Amazon S3 (which is in the "cloud") will make it more cost-effective for businesses and people to host their web sites.


Here are the technical notes on how it to set up your site at Amazon S3 after  you get an (free) Amazon Web Services account and go into the management console:
  1. Create a S3 bucket with the same name as the subdomain of your static web site. So, if your site is www.mysite.com, create a S3 bucket named  www.mysite.com
  2. Write two static HTML files called index.html and error.html.
  3. (Follow the instructions at the S3 Web Hosting Guide). Upload an index.html and an error.html file to the S3 bucket. 
  4. Right click on the S3 bucket (e.g. named www.mysite.com), and enable the Properties tab, and in there check the box to enable the web site, on the "Web Site" tab. 
  5. Designate your index.html as the main file and error.html as the error file. Set permissions on these files so that everybody can read. 
  6. The Properties tab will give you a URL for the site which looks something like www.mysite.com.s3-website-us-east-1.amazonaws.com. If you click on the link, you will see your index.html file rendered in a new web browser. 
  7. Go to your Domain provider and create a new CNAME record for your domain (www.mysite.com) and map it to www.mysite.com.s3-website-us-east-1.amazonaws.com as the address. 
After a few minutes or hours, your web site is live under a subdomain of your domain, and hosted at Amazon S3. 

3 comments:

  1. That's great. I think that'll help a lot of people. Thanks a lot for sharing.

    data protection australia

    ReplyDelete
  2. I would love to buy a static website and create a dynamic site out of it. Thanks for this procedure.
    document scanning services

    ReplyDelete
  3. I've done all this and it works great, but one question: having set a CNAME record for www.mydomain.com, how can I handle someone who requests just mydomain.com (that is, without the www)? I know that A records have a 'default' concept that routes traffic by IP address, but that's not an option because S3 doesn't provide static IPs. It's possible to do this, because Werner Vogels' blog (allthingsdistributed.com) which is definitely hosted on S3 works fine without the www.

    ReplyDelete