【发布时间】:2021-12-13 02:52:34
【问题描述】:
我正在尝试确定是否可以使用 AWS S3 访问点来托管静态 S3 网站。
S3WebsiteBucket.WebsiteURL 下面描述的资源效果很好,但我需要改用接入点。
每当我请求索引文件时的失败消息(URL 类似于 https://my-access-point-0000000000.s3-accesspoint.eu-north-1.amazonaws.com/index.html)如下:
无效请求 不支持您提供的授权机制。请使用签名版本 4。
我的 CloudFormation 模板:
AWSTemplateFormatVersion: '2010-09-09'
Resources:
S3WebsiteBucket:
Type: AWS::S3::Bucket
Properties:
AccessControl: PublicRead
WebsiteConfiguration:
IndexDocument: index.html
ErrorDocument: error.html
VersioningConfiguration:
Status: Enabled
S3WebsiteBucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
PolicyDocument:
Id: AllowPublicRead
Version: 2012-10-17
Statement:
- Sid: PublicReadForGetBucketObjects
Effect: Allow
Principal: '*'
Action: 's3:GetObject'
Resource: !Join
- ''
- - 'arn:aws:s3:::'
- !Ref S3WebsiteBucket
- /*
Bucket: !Ref S3WebsiteBucket
S3AccessPoint:
Type: AWS::S3::AccessPoint
Properties:
Bucket: !Ref S3WebsiteBucket
Name: my-access-point
PublicAccessBlockConfiguration:
BlockPublicAcls: true
IgnorePublicAcls: true
BlockPublicPolicy: true
RestrictPublicBuckets: false
是否可以将 S3 接入点用于此类任务,或者它不适合公共访问(静态网站)?如果可能的话,我是否遗漏了什么——也许 S3AccessPoint 需要自己的 IAM 访问策略?
我使用 S3 接入点的主要动机是隐藏原始存储桶名称,而不使用 Route 53 和自定义域。
【问题讨论】:
-
primary motivation for using S3 Access Point is to hide the original bucket name without using Route 53 and custom domains然后你打算如何在不使用域名的情况下访问内容? .您可以使用 CloudFront,它有自己的 dns 或您的自定义域名。 R53不是强制性的,你可以在别处控制主机名 -
@gusto2 不确定我是否理解您的问题,但计划是通过访问点域访问此内容,例如my-access-point-0000000000.s3-accesspoint.eu-north-1.amazonaws.…
-
The authorization mechanism you have provided is not supported.表示不允许通过此访问点进行公共访问。我不知道如何允许。我仍然会使用 Cloudfront 进行 Web 访问 -
@gusto2 在“权限”选项卡中显示“通过任何公共存储桶或访问点策略阻止对存储桶和对象的公共访问 - 关闭”,因此看起来某种公共访问应该可以正常工作。跨度>
-
你不能这样做。 S3 的网站模式仅适用于存储桶,不适用于接入点。
标签: amazon-web-services amazon-s3 amazon-cloudformation amazon-iam amazon-s3-access-points