how to forward godaddy domain to ec2 load balancer

49,530

Solution 1

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

Solution 2

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.

Solution 3

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

Share:
49,530

Related videos on Youtube

pablosd
Author by

pablosd

Updated on September 18, 2022

Comments

  • pablosd
    pablosd almost 2 years

    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?

  • mding5692
    mding5692 about 5 years
    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?
  • kakoma
    kakoma about 5 years
    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
  • Massimo
    Massimo about 5 years
    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.
  • carlin.scott
    carlin.scott over 3 years
    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.