将流量路由到 S3 托管的静态网站
有两个aws帐户。
帐户 1 具有托管区域 abc.io
帐户 2 包含带有静态网站的 S3 存储桶。
如何在 Account-1 的 Route53 中创建记录集,以便 my.abc.io
在另一个 AWS 账户上路由 s3 托管网站的流量。
Have two aws account.
Account-1 is having hosted zone abc.io
Account-2 contains the S3 bucket with static website.
How to create record set in Route53 in Account-1 so that my.abc.io
routes the traffic s3 hosted website on another aws account.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在 Account-1 的 Route53 中为
my.abc.io
创建一条 DNS CNAME 记录,并将其值设置为BucketName.s3.Region.amazonaws.com。
,其中 < code>BucketName 是您的存储桶名称,Region
是存储桶的区域。这将允许任何调用者将针对 Route53 托管区域的 DNS 查询重定向到 Amazon 的 S3 DNS 记录,因此该解决方案适用于 DNS 级别(而不是 HTTP 重定向级别)。
请注意,CNAME DNS 记录只是一个文本值,您可以指向任何域名(甚至
www.google.com
)。 CNAME 记录的值不需要与您的 Account-1 中的任何内容相关,甚至不需要与任何地方的 AWS 资源相关。使用 DNS CNAME 记录只是告诉 DNS 请求者“嘿,当您为
my.abc.io
请求 A 记录时,您实际上应该做的是为请求 A 记录>BucketName.s3.Region.amazonaws.com
。”AWS S3 存储桶的域名具有规范的命名方案。
有关更多信息,请参阅:
You can create a DNS CNAME record in Route53 in your Account-1 for
my.abc.io
to a value ofBucketName.s3.Region.amazonaws.com.
whereBucketName
is your bucket name andRegion
is the region of the bucket.This will let any caller redirecting DNS queries against your Route53 hosted zone towards Amazon's S3 DNS records, so this solution works on a DNS-level (not e.g. on HTTP redirect level).
Please note that a CNAME DNS record is just a textual value, that you can point to any domain name (even
www.google.com
). The value of a CNAME record does not need to be related to anything in your Account-1 or even anything related to an AWS resource anywhere.Using a DNS CNAME record is just a way to tell a DNS requestor "hey, when you requested an A record for
my.abc.io
what you actually should be doing is requesting an A record forBucketName.s3.Region.amazonaws.com
."And AWS S3 buckets have a canonical naming scheme for their domain names.
See for further information:
您可以在网站账户中创建HZ my.abc.io,并在顶级域名的账户中创建一条NS记录,并将值设置为与网站账户中HZ中的NS记录相同。
此后,您可以在该网站的帐户中创建将流量路由到您的网站所需的所有记录。我认为这种设计可以使帐户 HZ 更干净、更易于阅读/遵循。
我一直在使用这种设计,并且确实需要这样做,因为我们不仅有一个已连接到“顶级域帐户”的帐户。
You can create the HZ my.abc.io in the account with the website and create a NS record in the account with the top domain to it and set the values to the same as the NS record in the HZ in the account with the website.
After this you create all the records needed to route the traffic to your site in the account with the site. This design I think keep the accounts HZ cleaner and easier to read/follow.
I have been using this design and really need to do so due to that we not only have one account that we have connected to the "top domain account".