In this short tutorial, we will get a static website up, hosted in Amazon S3. You might already use Amazon S3 to host images, video, and other website content. Now you can host an entire static website on Amazon S3. I assume you already have an AWS account. If you don’t, you can sign up now at the Amazon Simple Storage Service website.
1. First, login to your Amazon S3 Console.
2. Click “Create Bucket” and give it a unique name. I will call it s3.teamextension.com. Click the “Create” button to complete the creation of your new bucket.
Note that if you plan to use a custom domain, which we will dicusss more later, you will need to name your Bucket the same name as your custom domain.
3. Upload the static files you want hosted. For this tutorial, I created a file called index.html which contains the text “Hello from Amazon S3!”. I also created a file called error.html, which will get served if an error, like a 404, occurs. Now click “Upload” -> “Add files”.
Click on “Set Permission >” button and click on the “Make everything public” checkbox. Then click on “Start Upload”.
Note you can also look into Bucket Policies if you don’t want to set the permission for each file you upload.
3. Now right click on your newly created bucket and click on Properties. It will display a new Properties pane on the bottom of the console. Click on the Website tab. Click on Enabled, enter index.html for the Index Document, and error.html for the Error Document. Before clicking on “Save”, take note of the Endpoint listed. For our example, the endpoint is http://s3.teamextension.com.s3-website-us-east-1.amazonaws.com/.
4. Visit the endpoint URL you noted and you should see your index.html.
5. Now, that endpoint isn’t really our ideal website URL. We most probably want to use our own domain name. To accomplish this, go to your DNS provider and add a CNAME. For this example, we will add a CNAME using cPanel.
If you are unsure how to add a CNAME, contact your hosting provider. Note that it’s important that your bucket name matches your CNAME. Amazon S3 uses this to map the CNAME to the proper S3 Bucket.
Now go to http://s3.teamextension.com and you should see your fully working website.
For the official Amazon S3 guide, see Hosting Websites on Amazon S3.
This Post Has 5 Comments
The problem with using CNAME however is that we loose the DNS entries for the mail server for that domain, which means anyone following these instructions may get an Amazon hosted website, but no email.
U R right Sam. The purpose is to create simple websites that do not need php or others. For those who want static webpages this is a great option.
Using a CNAME shouldn’t affect your mail at all as long you have valid MX records.
I am one of developer team member of Bucket Explorer,you can host your static website only using amazon s3,Bucket Explorer make it easier and its URL generate panel provides you different kinds of URLs to access your website.
Website hosting feature is a great improvement by amazon S3.
S3 Browser Freeware allows you to easily enable Website feature for your Amazon S3 Buckets!