将 AWS CloudFront 配置为可从 GoDaddy 域访问

Configure AWS CloudFront to be accessible from GoDaddy domain

我在 GoDaddy 域名提供商中配置了一个域名。 我创建了 Angular 可使用此云端内部网址访问的应用程序: xxxxxxxxx.cloudfront.net

问题是如何配置域以将 Web 请求正确重定向到托管在 AWS 上的此地址。我联系了 GoDaddy 支持,他们给出了这些说明:

In order to make changes we need the nameservers and the nameservers will be provided by the host that is aws
Once you have the nameservers, Please open the dns page
You will see 2 nameservers that are for godaddy
Click on change option and then select I will use my own nameservers and then update the nameservers that will be provided.

在哪里可以查看 AWS Cloudfront 中使用的名称服务器?

您需要先在 Route53 中设置域(例如 example.com),作为设置的一部分,您将获得 4 个名称服务器地址。您将 GoDaddy 的名称服务器更改为您的 AWS 名称服务器,如他们的支持所述,这授权 Route53 托管您的 DNS。从那时起,您可以从 Route53 管理您的 DNS,而不是 GoDaddy(但 GoDaddy 仍然是您的注册商)。

一旦您的名称服务器指向 route53,请遵循 docs on creating an alias in route53

If you want to use your own domain name, use Amazon Route 53 to create an alias record that points to your CloudFront distribution. An alias record is a Route 53 extension to DNS. It's similar to a CNAME record, but you can create an alias record both for the root domain, such as example.com, and for subdomains, such as www.example.com.

当您更改 GoDaddy 上的名称服务器时,您设置的任何 DNS 将不再在互联网上可见,只有 Route53 中的内容。将您在 GoDaddy 中创建的任何记录转移到 Route53 before 更改您的名称服务器。忽略您没有创建的任何 DNS 记录。

如果出现问题,您可以转到 GoDaddy 并将名称服务器重置为默认值,这将恢复以前的 DNS。

有一件事要提 - TTL - 生存时间。如果 DNS 记录具有较高的 TTL(以秒为单位),这意味着当您进行更改时,每个人都需要 最多 的时间才能获得更新。 TTL 将在 GoDaddy 中可见,或者您可以搜索“DNS dig”以查找读取 DNS 的在线工具。 NS 记录的 TTL 可能很高(几天、一周等)- 这将影响 Route53 完全接管您的 DNS 责任所需的时间。