CloudFront 发行版未显示为 Route53别名目标

我正在尝试添加一个53号公路的记录集,指向我的云端分布。但是,当我在路由53中选择“ create record set”并在随后的面板中单击别名目标时,云前发行版就不会被列出来。我得到的只是“没有目标”。我的发行版已经创建并启用(正在运行)。我已经在我的发行版中添加了一个与我在 Route53中设置的域名相同的 CName,但是它仍然没有显示出来。

如何让我的分布显示在别名目标字段,以便我可以指向一个 Route53a 记录到它?

谢谢

39339 次浏览

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.

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.

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

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.

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.

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.

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

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

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