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.

  • 7
    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
    Commented Feb 24, 2012 at 5:03
  • 2
    Above comment should be an answer.
    – thinice
    Commented Feb 24, 2012 at 5:09
  • Did you resolve your problem? Could you kindly share it here
    – Jeremy
    Commented Nov 19, 2014 at 7:01

3 Answers 3


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

  • 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
    Commented Feb 25, 2012 at 1:40
  • 2
    Created an A Record. That did it.
    – KevinDeus
    Commented Feb 25, 2012 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. Commented Feb 28, 2012 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
    Commented Mar 18, 2012 at 7:25
  • 1
    Perhaps you are trying to set the apex domain ("example.com" instead of "www.example.com")? That does require an A record as DNS does not support CNAME for apex domain. Commented Mar 21, 2012 at 19:33

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.


Better option is to assign an Elastic IP address to your instance. Once allocated, Create a "A" record in your hosted zone and add your instances Elastic IP as the value. This will point your domain name to the instance.

For detailed instruction, you can follow this blog. http://comtechies.com/2016/07/point-map-domain-name-aws-ec2-server.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .