简体   繁体   English

Amazon CloudFront 备用域名

[英]Amazon CloudFront Alternate Domain Names

I'm totally new to Amazon and all of its services.我对亚马逊及其所有服务完全陌生。 I have set up Amazon S3 and created a CloudFront distribution but what I want is to give a custom domain name to this CloudFront distribution.我已经设置了 Amazon S3 并创建了一个 CloudFront 分配,但我想要的是为这个 CloudFront 分配提供一个自定义域名。

I have created a sub-domain on my server and changed the CNAME to the CloudFront distribution link but I can not access to my content on S3.我在我的服务器上创建了一个子域并将CNAME更改为 CloudFront 分配链接,但我无法访问我在 S3 上的内容。 Can anyone tell me full go through how I can set up with alternate domain names?谁能告诉我如何设置备用域名?

To give a custom domain name to an Amazon CloudFront distribution:为 Amazon CloudFront 分配提供自定义域名:

  • Provide an Alternate Domain Name when creating your CloudFront distribution在创建 CloudFront 分配时提供备用域名
  • Create a CNAME record in Route 53 (or your own DNS provider) that points to the URL of your CloudFront distribution (eg d3i29vunzqzxrt.cloudfront.net ), or create an A record in Route 53 that uses Alias = Yes and select the CloudFront distribution.在 Route 53(或您自己的 DNS 提供商)中创建一个指向 CloudFront 分配 URL(例如d3i29vunzqzxrt.cloudfront.net )的CNAME记录,或在 Route 53 中创建一个使用Alias = YesA记录并选择 CloudFront 分配.

From the help tip in the CloudFront console:从 CloudFront 控制台中的帮助提示:

If you want to use your own domain name (for example, www.example.com) instead of the CloudFront domain name (for example, d1234.cloudfront.net) for the URLs for your files, specify up to 100 CNAMEs.如果您想使用自己的域名(例如 www.example.com)而不是 CloudFront 域名(例如 d1234.cloudfront.net)作为文件的 URL,请指定最多 100 个 CNAME。 Separate CNAMEs with commas or put each on a new line.用逗号分隔 CNAME,或将每个 CNAME 放在一个新行上。 You also need to create a CNAME record with your DNS service to route queries for www.example.com to d1234.cloudfront.net.您还需要使用 DNS 服务创建 CNAME 记录,以便将 www.example.com 的查询路由到 d1234.cloudfront.net。

I think the guide is designed to have you spend more than you should.我认为该指南旨在让您花费更多。 Instead, you should:相反,您应该:

  1. Add Alternate Domain Name as the guide says.按照指南添加备用域名。
  2. Create "A" record in Route 53, not CNAME.在 Route 53 中创建“A”记录,而不是 CNAME。 AWS will charge you for each CNAME request. AWS 将针对每个 CNAME 请求向您收费。

Update:更新:
Since this release (Apr 8, 2019) when you add an alternate domain name to a distribution, you must also attach a SSL/TLS certificate to that distribution that covers the alternate domain name.自此版本(2019 年 4 月 8 日)起,当您将备用域名添加到分配时,您还必须将 SSL/TLS 证书附加到覆盖备用域名的分配。

So, first of all make sure that after you registered the domain name with your domain provider (GoDadday, CloudFlare, Route 53 etc') and created a CNAME record you should do the following:因此,首先请确保在您向域提供商(GoDadday、CloudFlare、Route 53 等)注册域名并创建CNAME记录后,您应该执行以下操作:

Add an SSL/TLS certificate from an authorized certificate authority (for example - Let's Encrypt ) to CloudFront that covers the domain name you plan to use with the distribution - to validate that you are authorized to use the domain.将来自授权证书颁发机构(例如 - Let's Encrypt )的 SSL/TLS 证书添加到 CloudFront,该证书涵盖您计划用于分配的域名 - 以验证您是否有权使用该域。 (Read more in here ). (在此处阅读更多信息)。

And only then update your distribution to add an alternate domain name:然后才更新您的发行版以添加备用域名:
Open Amazon CloudFront console -> General view -> Edit -> Alternate Domain Names (CNAMEs) -> enter the CNAME that you want to associate with the CloudFront distribution (for example www or home).打开 Amazon CloudFront 控制台 -> 常规视图 -> 编辑 -> 备用域名 (CNAME) -> 输入要与 CloudFront 分配关联的 CNAME(例如 www 或 home)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM