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

3

5

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

Mccabe answered 19/11, 2011 at 2:5 Comment(0)
L
6

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.

Latashalatashia answered 19/11, 2011 at 2:38 Comment(2)
sarnold, thanks a ton for your help. I set up a new bucket named www.bret-truchan.com. Afterwards, I updated my route 53 CNAME value with the new endpoint (www.bret-truchan.com.s3-website-us-east-1.amazonaws.com). Finally, I set my index.html permissions following these instructions starting around the middle of this page: aws.amazon.com/articles/5050 Now it works great! Thanks!!Mccabe
Excellent, glad to hear it! :)Latashalatashia
R
3

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.

Revkah answered 18/7, 2014 at 5:0 Comment(1)
The documentation link is how to host a website from S3. This is DEFINITELY the answer for most people.Actable
A
1

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.

Aye answered 25/3, 2013 at 19:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.