How do you set up a cname for an S3 bucket using Amazon Route 53?

10,772

Solution 1

I don't think ping is a useful test -- ICMP packets are often dropped on the floor these days -- it isn't the reliable diagnostic that it once was. Sure, if it responds, you've got that -- but if you get a timeout, the most likely answer is a firewall (perhaps Amazon's group policies) DROPs the packet on the floor.

Incidentally:

$ host bret-truchan.com
$ host www.bret-truchan.com
www.bret-truchan.com is an alias for bret-truchan.com.s3-website-us-east-1.amazonaws.com.
bret-truchan.com.s3-website-us-east-1.amazonaws.com is an alias for s3-website-us-east-1.amazonaws.com.
s3-website-us-east-1.amazonaws.com has address 207.171.163.1
$ HEAD www.bret-truchan.com
404 Not Found
Date: Sat, 19 Nov 2011 02:35:15 GMT
Server: AmazonS3
Client-Date: Sat, 19 Nov 2011 02:35:15 GMT
Client-Peer: 207.171.163.213:80
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
X-Amz-Error-Code: NoSuchBucket
X-Amz-Error-Detail-BucketName: www.bret-truchan.com
X-Amz-Error-Message: The specified bucket does not exist
X-Amz-Id-2: MKHMddVEYia5cV0iU33QLg7vt6FgM69jyu+jKjTsh1aVuUR8seGwQQT2sfZrSlu9
X-Amz-Request-Id: 6681133093178B5F

If anything, it looks like the hostname www.bret-truchan.com is being used for the bucket -- and you said the bucket was named bret-truchan.com instead. That is probably the reason for the 404 response.

But the dropped ping packets are probably due to Amazon's firewalling.

Solution 2

For anyone arriving from google, this restriction is in the AWS documentation.

Step 2.1: Create Two Buckets

The bucket names must match the names of the website that you are hosting. For example, to host your example.com website on Amazon S3, you would create a bucket named example.com. To host a website under www.example.com, you would name the bucket www.example.com. In this example, your website will support requests from both example.com and www.example.com.

Solution 3

Simply name your bucket to bret-truchan.com. Be sure to make all the files public.

I ran into the same issue and this sorted it for me. Would be nice if you could rename the bucket easily and not have to re-create. Little touches like this would make AWS much less clunky.

Share:
10,772
clone45
Author by

clone45

I'm not here for fame or fortune. Just happy to help out.

Updated on June 16, 2022

Comments

  • clone45
    clone45 almost 2 years

    I am making a personal site for myself and I've decided to host it on Amazon S3. I'm also trying to use Amazon Route 53 for the nameserver, but I'm having some trouble getting it to work. I'm trying to set up a CNAME that points my domain name (bret-truchan.com) to the bucket.

    My bucket name is bret-truchan.com. It is configured as a website and browsing to the endpoint works just fine: http://bret-truchan.com.s3-website-us-east-1.amazonaws.com/

    I have added the four Amazon name servers to my DNS through my DNS provider's console.

    Here's my bucket setup:

    My Amazon Bucket Setup

    Here are my Amazon Route 53 record sets:

    My Amazon Route 53 record sets

    Here are the details of my CNAME. Notice that the CNAME's Name is set to *.bret-truchan.com. I guessed at this. I'm also not sure if the value of the CNAME is correct. I've read some examples where the CNAME value ends in a period, but mind does not.

    enter image description here

    Here's a ping test:

    ping test

    Any help would be much appreciated! Thanks so much!