How to Host a Website on Amazon S3
Audience: Novices who have no experience/knowledge of web development, who have never hosted a website themselves, but want to host a static website.
Amazon, isn’t that the site I buy shoes off of?
Most people know Amazon only as a big online department store, or even digital bookstore, but in 2002, they created a new department within their organization called Amazon Web Services (or AWS). This department provides a myriad of services to anyone needing processing, storing, sending, and hosting data. For example, one service, called Elastic Compute Cloud (EC2), lets you borrow a computer (that you connect and control through the internet) and use it for (mostly) anything you want. The “Cloud” in EC2 is the buzzword that you might have heard on the news. Amazon’s Web Services are all “in the cloud” because they present a simplified interface to interact with their enormously complex network of computers. Whereas in the past, increasing your computer’s speed by tenfold meant buying ten computers, hooking them up, and writing software to allow them all to share their resources, using Amazon, all you have to do is drag a slider. This saves lots of time and headache for people and so everyone seems to have gone bananas over the concept recently.
I thought we were talking about S3, not EC2.
Ah yes, so today we will use another service, Simple Storage Service (S3). This service lets you store files on an Amazon computer. These files can be then accessed by anyone connected to the Internet. This is handy because I just described a website.
How much does Amazon cost?
Amazon provides a calculator to figure this out. New users get a discount for a year, and Amazon charges you based on how much you use their service (which depends on how many files you store and how much traffic your site gets). I used the calculator, and assuming you store 1GB or less of stuff, and have 5000 visitors a month (which would be a likely scenario for a personal site), it’ll be free for the first year and 14 cents a month after that. Amazon can change their pricing at will, but in any case, the cost should be marginal.
Why use Amazon?
There are many companies have similar web services to Amazon. Microsoft has Microsoft Azure. Google has Google Cloud Platform . They all are competitors with similar services and pricing schemes. I simply chose Amazon because more people use them at the moment.Note: There are also a plethora of smaller companies that let you “borrow” computers to use as a web server (which is what these Internet-connected file-serving computers are called). Some examples include GoDaddy, Dreamhost, and Hostgator. In contrast to Amazon, these companies are not “cloud computing” services, but are regular web hosting companies. What that means to you is that they charge fixed rates per-month (instead of dynamically varying the pricing depending on your usage of the service). This means that it is usually cheaper to use Amazon.
Lets do it.Grab all the files you want to host and put them in a folder somewhere easy to get to, like the desktop. Create a new account on AWS. (You will need to provide a credit card) Go to your AWS batcave, ahem, management console. (And you were wondering why each service had an abbreviation...) Open the S3 tab in the management console, click “Create Bucket”. Name it “ryochiba-personalSite” or another title that describes your site. Note that the name of the bucket must be unique across all of the buckets hosted on Amazon, so prefix the bucket name with your name or something unique to make sure. Also, for the name:
- Should not contain uppercase characters
- Should not contain underscores (_)
- Should be between 3 and 63 characters long
- Should not end with a dash
- Cannot contain two, adjacent periods
- Cannot contain dashes next to periods (e.g., "my-.bucket.com" and "my.-bucket" are invalid)