2

My domains are managed on Google but my site is hosted on AWS. I want to point both my root my-company.com and the www subdomain www.my-company.com to an AWS Load Balancer, which has an address, not an IP.

Although I am allowed to add a Custom CNAME Resource Record for the www subdomain and it points to the LB address without any problems, I am not allowed to make the root record a CNAME record nor am I allowed to have the root A Record point to the LB address.

It seems I have no way to point my root domain to an AWS Load Balancer.

I tried looking into forwarding the domain to the www subdomain which works, but Google warns that then both the root and www records will be removed, so that would break the www forward to my LB.

I thought to create a subdomain prod.my-company.com and use domain forwarding to point both root and and www to prod (Google says that domain forwarding will not affect any subdomains accept www) but this will not work because it will forward users to prod.my-company.com.

I tried using AWS Route53 and was thinking of adding an NS record for root but Google also doesn't allow NS records for root!

Any thoughts on how to make this work?

2

This is a limitation in the fundamental design of DNS itself. Adding a CNAME at the apex of a domain is essentially invalid because it leads to an illogical set of consequences.

This is why Route 53 created A-Record Aliases -- to work around exactly this issue. Instead of an external referral, like a CNAME does, Alias records are an internal referral -- Route 53 looks up the record using an internal lookup from its own database, returning what is essentially a dynamically populated A record.

One option is to use a service like http://wwwizer.com, which gives you an A record for your example.com that simply returns a redirect to www.example.com. (To be clear, this isn't a recommendation or endorsement; I have no affiliation with this service and don't use it, but have seen it mentioned in this context.) The www record, of course, works fine with a CNAME.

Another option is to move the hosting of your DNS to Route 53 but not the domain registration. If your domain is registered with Google, you can retain the registration there, but host the records on Route 53... but this is not done by creating NS records. The process appears to be documented here.

The cost of Route 53 seems low enough to consider insignificant in this configuration, since they don't bill you for DNS queries that reach Alias records, when the Alias record terminates on ELB, CloudFront, or S3.

  • Is Route53 really free for this case? My domain is hosted on Google domains. For creating an alias record, I need to create a hosted zone in Route53. Looking at Route53 pricing, it says $0.50 per hosted zone / month. aws.amazon.com/route53/pricing – Amin Suzani Jun 12 '17 at 4:16
  • 1
    @AminSuzani you're correct about the $0.50 per hosted zone for each of the first 25 hosted zones or $0.10/zone after that. But you are not charged for any queries against alias records pointing to services. This is why I used the phrase "essentially free" -- for all practical purposes, the price is so low as to be not worth considering a meaningful factor. I'll clarify. – Michael - sqlbot Jun 12 '17 at 10:11

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.