Amazon S3 Website CNAME

While trying to create an S3-hosted static website I was trying to configure my domain to point to the S3 with a CNAME record on my DNS records for the domain.

The Amazon documentation mistakenly tells you to setup your CNAME to point to something like this:

#this is wrong!
 
my.domain.com CNAME my.domain.com.s3.amazonaws.com.
 
http://my.domain.com/index.html # will work
 
http://my.domain.com/ # will not work

This configuration will not work if you want directories to serve index.html by default. You may notice that if you type the complete URL you will get an S3 “Access Denied” message.

For your bucket, go to: Properties->Website
 
Endpoint: http://my.domain.com.s3-website-us-east-1.amazonaws.com/
You need: s3-website-us-east-1.amazonaws.com

Now you can configure your DNS settings.

# the proper configuration
 
my.domain.com CNAME s3-website-us-east-1.amazonaws.com.
 
http://my.domain.com/index.html # will work
 
http://my.domain.com/ # will work