By using AWS re:Post, you agree to the Terms of Use

CNAME for domain.com without www

0

Hi! I've been struggling with this issue and have been unable to find a solution. Thanks for your help!

My website url is www.domain.com - domain.com redirects to www.domain.com.

Currently, I have 2 A records (one for domain.com and one for www.domain.com) both of which point to my server's IP address.

I would like to stop specifying an IP address and instead use CNAME record(s) to point domain.com and www.domain.com to my server's CNAME.

I was able to easily do this for www.domain.com but I'm unable to setup a CNAME for domain.com (without the www).

What am I doing wrong?

Is there another way to accomplish this without using 2 CNAMES?

Thanks for your help!

3 Answers
0

Hi,

That's a limitation of DNS. However, you can route traffic for domain.com and for www.domain.com to your resources without using IP addresses if you're using an AWS service that supports Route 53 alias resource record sets. For more information, see "Choosing Between Alias and Non-Alias Resource Record Sets" in the Amazon Route 53 Developer Guide:

http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-choosing-alias-non-alias.html

Note that if you're using an S3 bucket that's configured as a website endpoint, you need to create a second bucket and configure it as a redirector. This is explained in "Getting Started with Amazon Route 53":

http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/getting-started.html

Scott

EXPERT
answered 6 years ago
0

Scott, thanks for your reply. I'm a bit of a noob with this type of DNS configuration and I don't think I fully understand what the article is recommending I do.

I have a cname setup for www.domain.com and it's working properly.

I have an A recomrd setup for domain.com that points to an IP address. It's working properly as well.

I'd like to replace the A record for domain.com with a CNAME for domain.com.

Can you walk me through what the settings should be for that?

When I try to create a CNAME for domain.com, I'm unable to do because I need to give the CNAME a name i.e. "www".

Thanks!

answered 6 years ago
0

Hi,

The short story is that you can't create a CNAME for domain.com because DNS forbids creating CNAME records at the root of a domain. Various DNS services offer workarounds; with Route 53, the workaround is to create an alias record. However, you can create an alias record only if the resource that you're routing your traffic to is a CloudFront distribution, an S3 bucket, an Elastic Beanstalk environment, or an ELB load balancer.

You created a CNAME record to route traffic from www.domain.com to domain.com. Nothing more to do there.

If you're using one of the resources listed above, you can create an alias record for domain.com. That saves you the trouble of specifying an IP address.

If you're using another resource, such as a web server running on an EC2 instance, you need to specify an IP address somewhere so Route 53 knows what IP address to return in response to DNS queries for www.domain.com and domain.com. That's the A record that you currently have for domain.com. Everything is working properly, so you're done. :-)

Scott

EXPERT
answered 6 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions