23

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?

29

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

8

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 '19 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 '19 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
  • 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. – carlin.scott Feb 5 at 20:57
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.

-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 '19 at 9:37
-6

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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