Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an EC2 instance. It's up and running with an Amazon IP that looks something like this: //ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com/

I am sure it works fine.

I bought a domain and then set up a "Hosted Zone" in Amazon Route 53 and it gave me some name server info once I did. I went to my domain registrar and put those names into the name servers.

Now I'm stuck. How do I associate this Hosted Zone with my instance? I'd like Amazon to host so that's fine.

share|improve this question
6  
Briefly: a) allocate and assign an elastic IP address to your EC2 instance, if you haven't already done so. b) Create an A record in Route 53 that points to your instance's elastic IP address (the actual numerical IP address though, not the DNS style you have used in your question) –  cyberx86 Feb 24 '12 at 5:03
2  
Above comment should be an answer. –  thinice Feb 24 '12 at 5:09

2 Answers 2

If you're using the AWS console, then you can associate your desired hostname (e.g., www.example.com) with the IP address of the EC2 instance using a CNAME record to the external DNS name for the instance.

For example:

  • Navigate to the hosted zone you created (double click works)

  • Click [Create Record Set] at top

  • Name: www.example.com

  • Type: CNAME

  • Value: ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com.

  • Click [Create Record Set] at the bottom of the form

I also recommend you learn about Elastic IP addresses. You should allocate an elastic IP address, associate it with your instance, and then map the CNAME to the new external DNS name for the Elastic IP address on your instance. This will let you move the Elastic IP address between instances without having to update your DNS.

If you're curious why I recommend a CNAME instead of using an A record, here's a benefit I wrote about when talking between instances inside EC2: http://alestic.com/2009/06/ec2-elastic-ip-internal

share|improve this answer
    
hmmm. did that but it never associated. I then created an Elastic IP like you said, and created a CNAME for that, (elastic ip goes to my app now), but going to my domain returns a 502 error ("The requested name is valid, but no data of the requested type was found ") –  KevinDeus Feb 25 '12 at 1:40
2  
Created an A Record. That did it. –  KevinDeus Feb 25 '12 at 8:16
    
An A record will work, but a CNAME is better, especially if your instances talk to each other. Make sure you include a period (.) at the end of the target for the CNAME. –  Eric Hammond Feb 28 '12 at 0:00
    
definitely wont work with CNAME. I switched my A record over to CNAME and Google lost the site for about 30 minutes! –  KevinDeus Mar 18 '12 at 7:25
    
KevinDeus: What do you mean "Google lost the site"? CNAME does work if you do it correctly. –  Eric Hammond Mar 19 '12 at 16:18

Well for me it was pretty easy. I had 2 separate situations where I needed to assign my domain name to instances:

  1. In the first case, I had a 6 web-servers behind a single load balancer. And I wanted to assign it my root domain, let's say: mydomain.com I simple updated dNS for mydomain.com and instead of creating an A record, I assigned a CNAME for mydomain.com (yes the domain root), pointing to the Public DNS of the load balancer.
  2. In another instance, I had a single web-server. There also I created a CNAME of the domain pointing to the Public DNS of the web-server itself.

Its exactly similar to how you create CNAME records to point to ghs.google.com when using Google Apps.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.