第一个存储桶,东西-cf-validate-origin-primary-devops,在带有内容的S3存储桶的根目录中具有index.html,
<html>
<body>
Home page
</body>
</html>
第二个存储桶,single-cf-validate-origin-failover-devops,在S3存储桶的根目录中具有index.html。
<html>
<body>
Maintenance page
</body>
</html>
两个S3存储桶都具有静态Web托管功能,并且可以通过端点公开访问。
Cloudfront发行版包含两个起源。
以下来源组,
行为指向原始组,
Cloudfront的默认根对象设置为index.html
当我点击Cloudfront Distribution的域名时,我得到的是“主页”。
[当我在第一个存储桶中将index.html重命名为index-disable.html时,我应该获得“维护页面”,因为Cloudfront故障转移应该从第二个存储桶提供该页面,因为它从第一个存储桶获得了404。
但是当我将index.html重命名为index-disable.html时,出现“访问被拒绝”的问题。
从AWS documentation
Check if the requested object exists in the bucket. If a user doesn’t have s3:ListBucket permissions, then the user gets Access Denied errors for missing objects instead of 404 Not Found errors. Run this AWS CLI command to check if an object exists in the bucket
在这种情况下,用户是存储桶策略,因此需要授予s3:ListBucket
权限。403进行故障转移可能更容易。