Mapping Amazon AWS S3 to a Custom Domain Name

According to Amazon’s Developer Guide you can setup Virtual Hosting of your files by adding a CNAME in your DNS server. I’ve sinced mapped a subdomain s3.brangle.com to Amazon’s S3 cloud.

The way I did this was to create a CNAME entry on my DNS server mapping
s3.brangle.com to s3.brangle.com.s3.amazonaws.com.
and yes, that is a period at the end of s3.brangle.com.s3.amazonaws.com. Now just creating the CNAME entry only redirects users to Amazon S3, Amazon needs to know which bucket to use. The name of the bucket needs to be the fully qualified domain name (FQN) that you are using. So in my example, my bucket name is s3.brangle.com.

In general, if you want to create subdomain.domain.com then your bucket will have to be named subdomain.domain.com. I was under the impression that I could create s3.brangle.com and name the bucket whatever I wanted with a

Depending on your needs, you might not want “s3.amazonaws.com” to appear on your web site or service. For example, if you host your web site’s images on Amazon S3, you might prefer http://images.johnsmith.net/ as opposed to http://johnsmith-images.s3.amazonaws.com/.

The bucket name must be the same as the CNAME. So http://images.johnsmith.net/filename would be the same as http://images.johnsmith.net.s3.amazonaws.com/filename if a CNAME were created to map images.johnsmith.net to images.johnsmith.net.s3.amazonaws.com.

Any bucket with a DNS compatible name may be referenced as follows: http://[BucketName].s3.amazonaws.com/[Filename], for example, http://images.johnsmith.net.s3.amazonaws.com/mydog.jpg. Using CNAME you can map images.johnsmith.net to an Amazon S3 host name so the previous URL could become: http://images.johnsmith.net/mydog.jpg.

The CNAME DNS record should alias your domain name to the appropriate virtual hosted style host name. For example, if your bucket name (and domain name) is images.johnsmith.net, the CNAME record should alias to images.johnsmith.net.s3.amazonaws.com.