This article is a quick rundown on how to host a static website using Amazon S3 and your domain registrar.

Assuming you already have an Amazon Web Service account the first step would be to open up you AWS Management Console and select the S3 Service.

Once at the S3 Management Console, complete the following steps:

  1. Create a new bucket with the domain you will be hosting at (including the www. for this example).
  2. Select Static Web Site Hosting under the properties of the newly created bucket.
  3. Select Enable website hosting and enter a file name for the index document.
  4. Select Permissions and then open Edit Bucket Policy. Enter the following (change the www.example.com to your full bucket name):

    json { "Statement": [ { "Sid": "AddPerm", "Effect": "Allow", "Principal": { "AWS": "*" }, "Action": [ "s3:GetObject" ], "Resource": [ "arn:aws:s3:::www.example.com/*" ] } ] }

  5. Navigate to your IAM Management Console and open the section labeled Access Keys (Access Key ID and Secret Access Key).
  6. Create a new key/value pair (or use a preexisting one).
  7. Enter these credentials in an app that support S3, like Transmit, and then upload the contents of your static site to the bucket you created.

Next up is to configure your domain registrar to correctly point to the newly created bucket. These directions are specific to Namecheap.com.

  1. Login to your account and head over to the Manage Domains page.
  2. Select the domain you want to point to the Amazon S3 bucket.
  3. Make sure you are using the registrars name servers (DNS).
  4. Edit the host records on the All Host Records page (link in sidebar) to look like the example below:

The long URL in the second row can be found in the Static Web Site Hosting section of the AWS Management Console.

Host Name IP Address / URL Record Type TTL
@ http://www.example.com/ URL Redirect 1800
www www.example.com.s3-website-us-east-1.amazonaws.com. CNAME (Alias) 1800

Note: Make sure that you DO NOT set the @ host name to be a CNAME (Alias) if you have MX records. This will prevent any email you have set up from working.