LDJ
LDJ

Reputation: 7304

CloudFront distribution not showing as Route53 alias target

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

Upvotes: 128

Views: 59977

Answers (11)

Roger Hill
Roger Hill

Reputation: 4101

Ok there is a chain of dependencies that exist that aren't well documented.

Do this in order:

  1. Buy or transfer a domain name in route 53.
  2. Create your route 53 zone to host this domain name. Route 53 is a global service, so it doesn't matter which region you are working out of.
  3. Go create a ACM cert. ACM is a service which cares about region, but your cert to allow HTTPS calls needs to be mapped to your DNS, so you need to create this in n.Virginia (us-east-1) region.
  4. Now you can go create a A record and alias it to a cloudfront distro. Your site should appear in the drop down list of valid targets.

Upvotes: 0

garryp
garryp

Reputation: 5766

I wanted to point a subdomain to CloudFront. I added it here and it started showing CloudFront in Route53 having previously hidden it.

enter image description here

Upvotes: 2

nate sire
nate sire

Reputation: 79

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

Upvotes: 7

DonCarleone
DonCarleone

Reputation: 829

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...

Upvotes: 9

learnAsWeGo
learnAsWeGo

Reputation: 2272

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

Upvotes: 2

unixeo
unixeo

Reputation: 1186

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.

Upvotes: 7

Remotec
Remotec

Reputation: 10758

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.

Upvotes: 6

jelder
jelder

Reputation: 2430

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.

Upvotes: 133

Andrew Clark
Andrew Clark

Reputation: 1123

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

Upvotes: 46

Edson Marquezani Filho
Edson Marquezani Filho

Reputation: 2696

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.

Upvotes: 94

imperalix
imperalix

Reputation: 3741

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.

Upvotes: 19

Related Questions