A computer engineer poking at your cerebral cortex.

Amazon Web Hosting With S3 Buckets



I started using Amazon Web Services (AWS) about 3 years ago and slowly built all my personal and business web properties onto the Amazon cloud EC2. AWS has some amazing feature and one that has blown me away for the past month or so is the Amazon S3. For the longest time I was using EC2 instance to host all my web properties but realized over the years I was wasting money. Specifically when it came to hosting my own blog. I will talk in a future post on how I deployed this blog into S3 but for now I want to talk about some of the features of S3.

S3 is a very simple file system inside the AWS services. The first part is creating a new bucket for your files. Each bucket is a unique identifier tied to your account. S3 really only contains 3 commands total: put -puts a file, get – gets a file and delete – deletes a file. S3 also contains folders like any tradition file system.

Now when I first heard of S3 I just assumed this was just a fancy FTP service why would I need this? I could easily create an EC2 instance and SCP files to a typical linux server and be done with it. Over the years though I realized this method isn’t ideal. I realized I started to manage more and more servers with static content on them. I also realized that my blog which was barely getting any web traffic was costing more then I wanted to spend a month. Amazon S3 fixed all these problems.

Eventually S3 enabled web hosting which changed the game on what S3 can do. Now you can put static web sites onto S3 and serve them over the web via http. This completely eliminates EC2 charges and managing a linux server. Two things that I wish I have done a long time ago. Another advantage to S3, so I have heard S3 can basically support unlimited traffic. While most of my sites only have small spikes here and there I was always worried one day a site would get a ton of traffic and crash my micro EC2 server. Sure I could have scaled up to bigger servers and spent a ton more in hosting waiting for that day when all that traffic would come.

Another huge advantage of S3 is making it your entry point to your web site as an S3 bucket. If you ever have studied how people visit web sites you realize tons of traffic will hit your home page and only a certain percentage click through to the next page. Since all my companies web properties and other web sites contain static sites for the first page this is a perfect fit for S3. A simple example is when a company runs a TV ad. All that traffic will slam the S3 bucket and only a percentage actually makes it through to the dynamic content on the next page.

The final deciding factor was cost. A micro EC2 server which people say can barely support any web traffic averages around 20 dollars a month. If you have the free tier for the first year you are lucky. I was an amazon customer prior to anything free. The price for S3 is First 1 TB / month $0.095 per GB. I don’t even come near this 1GB for many simple sites. Also amazon First 1 GB out as web traffic is completely free. After 1GB it is .12 cents per GB. I really have a feeling my hosting costs for next month are going to be under a dollar which is completely crazy. I’m sure your hosting giant TB of movies or something this price could go allot higher but for the normal traffic of any web site I have to say I absolutely love Amazon S3.

Now for some more techinical stuff. Your amazon S3 bucket sould match the name of the domain you are using. For example this site is running on www.frackingtubes.com so that is the name of the bucket. The one weird thing I run into with many sites is you want to get www.frackingtubes.com & frackingtubes.com to work. The easieast way I found to get this working is using Amazaon route53. Route53 provides DNS entries for your domain name. You have to log on and and your domain name to route53 and change all the nameservers from your current provider to the ones amazon gives you. Once the nameservers are added create two records. The first record is called the apex of the domain (frackingtubes.com). You want to great an alias to the frackingtubes.com bucket on S3. Then change to the S3 bucket and click web hosting and select redirect all traffic to www.frackingtubes.com. Then go back to route53 and add a cname for www.domain.com and point it at your bucket. This way both domains work while only updating 1 S3 bucket with your contents. I’m assuming you could also do this the other way around but haven’t tried. Please post in the comments if you have any questions.

More information can be found for S3 and Route53.