从单独的 S3 存储桶提供子文件夹

Serve subfolders from separate S3 bucket

我正在尝试提出一个使用 CloudFront 将多个单页应用程序部署到 S3 的解决方案。

我目前有 3 个 SPA

理想情况下,这些服务将在

为了促进这些应用程序的独立部署,我想将它们托管在单独的存储桶中(使用单独的 CloudFront 发行版)以使部署更安全、更快速。

我在想象这样的事情:

*Bucket name*
root -> has dns for myproduct.com
   /signup -> serves s3://signup
   /onboarding -> serves s3://onboarding
   /admin -> serves s3://admin
signup
onboarding
admin

是否有任何推荐的 s3 配置可以完成上述设置?

您可以创建具有三种行为的单个 Amazon CloudFront 分配

来自Cache Behavior Settings

When you create a new distribution, you specify settings for the default cache behavior, which automatically forwards all requests to the origin that you specify when you create the distribution. After you create a distribution, you can create additional cache behaviors that define how CloudFront responds when it receives a request for objects that match a path pattern, for example, *.jpg.

...

When you create a cache behavior, you specify the one origin from which you want CloudFront to get objects. As a result, if you want CloudFront to distribute objects from all of your origins, you must have at least as many cache behaviors (including the default cache behavior) as you have origins.

(您可能必须在三个存储桶中使用匹配的子路径。)