CloudFront distribution not showing as Route53 alias target

Amazon Web-ServicesAmazon CloudfrontAmazon Route53

Amazon Web-Services Problem Overview


I’m trying to add a route 53 record set that points to my cloudfront distribution. However, when I select ‘create record set’ in route 53 and click the alias target in the subsequent panel, the cloud front distribution is not listed. All I get is ‘No targets available’. My Distribution has been created and is enabled (and is working). I have added a CName to my distribution with the same domain name that I’m setting up in Route53, but it still doesn’t show.

How do I get my distribution to show in the Alias Target field so that I can point a Route53 ‘a’ record to it?

Thanks

Amazon Web-Services Solutions


Solution 1 - Amazon Web-Services

Combining several correct but incomplete answers:

  1. Only A records and AAAA are supported. Not CNAME records.
  2. The Route53 "Alias Target" box matches against CloudFront distributions' "Alternate Domain Names" field. If you're creating a new record set for something.example.com, you should have already set the alternate domain name for one of your distributions to something.example.com.
  3. The Route53 Management Console can be slow, and it might not find your distribution right away — wait until the distribution status is Deployed.

Solution 2 - Amazon Web-Services

Make sure you have set one or more Alternate Domain Names for you distribution, otherwise it won't be listed on the target combo for Route53 Alias.

As far as I understand, that's the same as configuring ServerAlias on your Apache's VirtualHost (or the correspondent for Nginx and so on). Without it, your requests wouldn't be identified as destined to that distribution when it gets there.

From AWS's documentation:

> If you're using CloudFront to distribute your content, you can use Amazon Route 53 to route queries to your CloudFront distribution. The name of your Amazon Route 53 hosted zone (such as example.com) must match an alternate domain name in the CloudFront distribution. You cannot route queries to the CloudFront domain name for your distribution (such as d111111abcdef8.cloudfront.net). The following procedure assumes that you have already registered the applicable domain names.

Solution 3 - Amazon Web-Services

Make sure it's an A record rather than a CNAME record (weird, I know). I found that buried in the documentation here:

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

Solution 4 - Amazon Web-Services

If your distribution does not show as an alias target, you can always manually copy and paste the d123.cloudfront.net (replace d123.cloudfront.net with the actual DNS name of your distribution) in to the target. This will allow you to create the alias record.

Solution 5 - Amazon Web-Services

Make sure your CloudFront distribution includes the name of your site (example.com )! I was having the same issue and spent well over an hour trying to solve the problem...

Solution 6 - Amazon Web-Services

TL/DR

Set your Origin ID in the origin in your Cloudfront Distribution to be the same as the domain name you are trying to create an alias for

More Detail

I struggled with this for some time.

In the end I compared a working CloudFront distribution which did show up in Route 53 with one that did not.

What I noticed was that the Origin Id specified in the origin for the distribution was not the domain name for my site.

This option is found in: CloudFront Distributions > [Id of distribution] > Origins and Origin Groups > Origins.

I only had one origin listed where the path was the name of a public s3 bucket. This entry also had an Origin ID field. When I updated this to be my domain name (without the www prefix) e.g. testdomain.com then I was able to see this cloud front distribution in the route 53 alias drop down.

Solution 7 - Amazon Web-Services

The trick was to enter the www before the domain because CloudFront matches against that alternate domain name with www or whatever subdomain you use. Type www or your subdomain and it will find the distribution.

cloudfront

Solution 8 - Amazon Web-Services

You have to fill the Alternate Domain Names (CNAMEs) field e.g. use

www.my_site.com  
*.my_site.com

For SSL Certificate field select

Custom SSL Certificate (example.com)

for this you will have to create and verify your domain with ACM, ACM has to be created in Virginia.

After that you will be able to see the Cloudfront in R53.

Solution 9 - Amazon Web-Services

It was taking forever for my cloudfront distribution status property to read deployed.

However inputting the cloudfront domain url into my address bar brought me to my website, aka the cloudfront domain url was live.

Feeling impatient, I copied this domain address and pasted it into the alias target field.

It worked!

enter image description here enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLDJView Question on Stackoverflow
Solution 1 - Amazon Web-ServicesjelderView Answer on Stackoverflow
Solution 2 - Amazon Web-ServicesEdson Marquezani FilhoView Answer on Stackoverflow
Solution 3 - Amazon Web-ServicesAndrew ClarkView Answer on Stackoverflow
Solution 4 - Amazon Web-ServicesimperalixView Answer on Stackoverflow
Solution 5 - Amazon Web-ServicesDonCarleoneView Answer on Stackoverflow
Solution 6 - Amazon Web-ServicesRemotecView Answer on Stackoverflow
Solution 7 - Amazon Web-Servicesnate sireView Answer on Stackoverflow
Solution 8 - Amazon Web-ServicesunixeOView Answer on Stackoverflow
Solution 9 - Amazon Web-ServiceslearnAsWeGoView Answer on Stackoverflow