I recently registered a domain name for some static content i'm hosting in Amazon's Simple Storage Service (S3). Setting up an S3 bucket as a static website is pretty straight-forward, but pointing your domain to it is tricky. After a bit of playing and googling I think I've got the right combination:

Step-1: Create your S3 website bucket

When naming your bucket you must use the same name as your domain - e.g. www.mydomain.com. The website end-point will then be something like www.mydomain.com.s3-website-eu-west-1.amazonaws.com. If you don't do this you will get warnings (404 not found, nosuchbucket).

Step-2: Remove any existing "A" records

Using the administration tools provided by your domain registrar, remove any "A" records that may have been automatically set up for your domain - you don't want your domain name pointing to "parking" sites.

Step-3: Forward your root domain to www

Forward your root domain (mydomain.com) to the www subdomain (www.mydomain.com). Most registrars and hosting companies give you the ability to forward domain names. With Fasthosts I had to "add" forwarding to my package, but it didn't cost anything extra.

If you can mask the forwarding, so much the better, as this will mean that visitors to your site will see your registered domain rather than the S3 url (depends what your registrar offers - fasthosts and godaddy both support masked forwarding). In Fasthosts admin, masking is a checkbox option in the forwarding configuration.

Step-4: Add a `CNAME` pointing to your S3 site

Add a CNAME for the www subdomain, pointing to your S3 website (www.mydomain.com.s3-website-eu-west-1.amazonaws.com). The admin tools should make this easy for you.

Add a CNAME

That's it - all you have to do now is wait for the changes to propagate (this can take a while).

See it in action...

You can see this in action with my setup:

My domain-name is overpayment-calculator.com, which forwards to www.overpayment-calculator.com, which points (via CNAME) at my S3 bucket www.overpayment-calculator.com.s3-website-eu-west-1.amazonaws.com, masking the S3 name (so that when you visit via the overpayment-calculator.com address you don't see the S3 address in the address bar).

p.s. props to fasthosts - the dns information propagated extremely quickly - from registering the domain name to acessing my site via that domain name (including the time it took me to do the set up) took less than one hour!

blog comments powered by Disqus