Static Website hosting with Amazon S3

Amazon Web Services (AWS), has several different sets of features that can be seen as very attractive for webhosting. One of the newer and slightly less documented features is the ability to host static websites in their entirety out of Amazon S3 (Simple Storage Service).

S3 is a large folder of unlimited size that you can upload files to, and either use directly from S3 or generate public links for. The data is organized in buckets, the names of which have to be globally unique across Amazon's whole system. S3 is designed to have absurd durability (99.999999999%), and to be quick and infinitely scalable. Their top storage pricing level is 5000 TB +. This makes S3 a very desirable solution for serving static files.

Billing for S3 is done in 3 different ways, storage, bandwidth, and requests. Overall it's pretty cheap, and could result in hosting for a small site costing less than 25 cents a month.

Content can be set to be publicly available on either a file or bucket level. If you enable the whole bucket to be a website, they require that you give them the path to your index and 404 document.

This site is running Drupal, but for the static content (documents, pictures, music, videos), I wanted to map my bucket to a subdomain (static.dustinhess.com) to take advantage of the unlimited size, and infiinite scalability of S3. I tried unsuccessfully for several days before I discovered that if you are going to use a bucket as a website, it's name has to be the fully qualified domain name that you have it set to be in DNS.

So, for example I was trying to set a bucket called "dustinhess" to be mapped to static.dustinhess.com, and while any requests to the path that amazon gave me dustinhess.s3-website-us-east-1.amazonaws.com would return the requested files, I couldn't get anything on the mapped domain.

Changed the bucket to be static.dustinhess.com, re-mapped it, and it's working great. I have yet to find this documented anywhere on amazon's website.

I am going to be putting up a few more posts about the various components of AWS that I am using and the ups and downs of each as I find them, but if you have any questions, shout them out.

Comments

Add new comment