27

I have a domain with godaddy: example.com

I have an ec2 load balancer pointing to an ec2 instance.

I would like to example.com to point to my load balanced instance.

I first added a www cname record for my elb DNS. Then I forwarded example.com to www.example.com

What do I put in the A Name record on godaddy?

11 Answers 11

33

You can't.

ELB provides one -- or more -- IP addresses, hiding behind the CNAME you are using with www record, and these addresses are not static, so you can't create an A record at the top ("apex") of your domain and point to the addresses... along with that, a CNAME at the apex of a domain is not a valid DNS configuration. So there isn't directly a way to do this.

You can either use Go Daddy's web site forwarding feature to redirect example.com requests to www.example.com, which will cause the browser to change its address bar value from example.com to www.example.com and then send traffic to the ELB (via the www CNAME)... or you can move the DNS from Go Daddy to Amazon's Route 53 service, which has another feature that operates similarly to a CNAME but is implemented differently, consistent with the rules established in RFC-1912. They call these ALIAS records.

An Alias record in Route 53 is a pointer to internal configuration within Route 53 that allows that service to look up and return an appropriate A-record for the service to which the Alias record is pointing.

http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/CreatingAliasRRSets.html

10

In addition to the accepted answer, another option is to create an AWS hosted zone in AWS Route 53 following the steps below:

  1. Sign in to the AWS Management Console and open the Amazon Route 53 console at https://console.aws.amazon.com/route53/.

  2. Choose Create Hosted Zone.

  3. You'll need to ensure your hosted zone points to your loadbalancer. To do this, create an A record and select alias and from the dropdown list returned, select your load balancer
  4. Go ahead and create a CNAME record and point it to the record you created in step 3

More here on creating a hosted zone: http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/CreatingHostedZone.html

Each hosted zone creates nameservers for you so once created, get the provided name servers and update godaddy to use those nameservers.

Your GoDaddy domain will now be pointing to an AWS hosted zone which in turn points to your load balancer.

2
  • Is it possible to explain step 4 in further? I'm a beginner at DNS records, do we create the CNAME record on godaddy or on AWS Route 53?
    – mding5692
    May 24, 2019 at 19:13
  • 1
    Hi @mding5692, yes, sure! Steps 1 to 4 are done on AWS Route 53. For 4 in particular, a CNAME has a value field - that's where you'll put whatever you defined in the A record in step 3. On GoDaddy, you will specify the nameservers listed in the hosted zone. I hope this is a bit clearer
    – kakoma
    May 31, 2019 at 14:55
1

You can also remove the default(@) A record if there is one and most browsers will just try www instead. That worked for me.

1
  • 3
    I tested this on Chrome and Opera. They did not automatically try the www subdomain. Browsers remember if you visited the www domain and will automatically use it, but if you've never visited that domain, then they do not do this. So this is not a solution to the problem. Feb 5, 2021 at 20:57
1

Yes you can, first get the static ip addresses of the load-balancer from aws dashboard->Ec2->Network & Security->Network interfaces->search by load balancer name, find the ipv4 column. Then add all of them (there will be 3 ip addresses) to A records in your dns manager in go daddy and you are done.

1
  • This solution worked for me. I could not add all 3 ips to one @ 'A' record, had to create 3 records. 2 days ago
0

I just tried to use godaddy DNS to point the @ record to a CNAME. But It's seems that I was unable to fix the problem. following above guideline then works.

point your domain to route53 and follow choose your desired A record and pass the record through Alias. You should able to gain the success.

0

You can successfully do this by creating a CNAME record in GoDaddy that 'Points To' the amazonaws.com DNS record that AWS provides for your Load Balancer. See their documentation here:

https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/using-domain-names-with-elb.html

0

If you can forward DNS from GoDaddy to AWS Route 53, then do that. It's much easier than the alternative, which is to create a server with a static IP that redirects to your www subdomain. Now GoDaddy does offer a service that does exactly this, but it doesn't support HTTPS redirects because they don't have the certificate that you are using in AWS. So the browser will not follow the redirect without an ominous warning about security. That's not a good look.

What I did was I stood up an NGINX server on an AWS EC2 t2-micro instance, installed the wildcard cert for the domain, and configured it to redirect to my www domain. This works fine, but costs a couple dollars each month, and doesn't work with AWS managed certs. So each year or two, you will need to manually renew your site certificate and install it on the nginx server. Or perhaps you can set up a script to auto-renew through Let's Encrypt.

0

You can use aws globalaccelerator with ELB,if you used elb with globalaccelerator,you can get two static ip address.

-1

I been looking for the solution to this problem and it finally turned out to be a very simple process.

In AWS it says (A record) but actually you just need to add CNAME record and value as Load Balancer URL. For primary domain use following values:

host :[www] value: [load balancer link]

For a subdomain add following:

host [any subdomain name] value : [load balancer link]

and thats it... Your AWS load balancer should now be connected with your domain or subdomain.

Thanks to this article

https://shlomoswidler.com/2009/07/elastic-in-elastic-load-balancing-elb.html

1
  • This can't be done for a domain name ("domain.com"), only for a host name ("www.domain.com"). The OP asked about a domain name, and you can't define a CNAME record there; only A records are allowed.
    – Massimo
    Jun 14, 2019 at 9:37
-1

By A, they mean ALIAS! They just shorten ALIAS to A for some reason. ALIAS is a DNS record which acts like CNAME but it actually resolves the IP of the CNAME and makes itself a A record pointing to that IP. Just assume ALIAS is a A record pointing to a CNAME's IP.

Also, if you're using Cloudflare like me, you can just create a CNAME record for @ and it will be happy with it (NOTE: It will not exactly be CNAME but ALIAS)

2
  • Why the downvote? Remember to provide a reason so the author and readers and can learn. Dec 9, 2022 at 16:48
  • An A record must target an IP address. That's a requirement of such records. Whereas a CNAME record will target another record. Some DNS services that also host websites, will dynamically update the A record to point at IP addresses that they own. So that's why you can use @ in an A record on Cloudflare to point at a hostname managed by them. If you actually look up that record using nslookup it will give you IP addresses. AWS Route 53 also does this if you're pointing at something hosted in AWS. May 30, 2023 at 22:26
-6

We can use a ec2 with varnish and nginx to point to an external ip for website hosted on godaddy.

You must log in to answer this question.

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