每个子域的 AWS S3 静态网站存储桶路由

AWS S3 static website buckets routing per subdomain

我创建了一个托管区域:“abc.com”和 2 个 s3 存储桶:“app1.abc.com”和“app2.abc.com”以及各自的 index.html .我能够成功访问单个默认 s3 网站(例如:app1.abc.com.s3-website-ap-southeast-1.amazonaws.com 和 app2.abc.com.s3-website-ap-southeast -1.amazonaws.com)

现在,如何创建记录集以重定向流量 让我们假设如果调用了“app1.abc.com”,那么应该访问“app1.abc.com”存储桶的 index.html。如果调用“app2.abc.com”,则应访问“app2.abc.com”存储桶的 index.html。

s3和route53可以吗?如果没有任何其他方法可以将基于 url 的流量重定向到 s3 存储桶?

我查看了文档,但没有任何线索。感谢您的帮助。

您只需创建一个指向 app1.abc.comapp1.abc.com.s3-website-ap-southeast-1.amazonaws.com 的 CNAME 记录。第二个桶的过程相同。

有关文档,请参阅 https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html#VirtualHostingCustomURLs