是否可以将 S3 访问点用作静态网站?
Is it possible to use S3 Access Point as a static website?
我正在尝试弄清楚是否可以使用 AWS S3 访问点来托管静态 S3 网站。
S3WebsiteBucket.WebsiteURL
下面描述的资源很好用,但我需要改用 Access Point。
每当我请求索引文件时的失败消息(URL 类似于 https://my-access-point-0000000000.s3-accesspoint.eu-north-1.amazonaws.com/index.html)如下:
InvalidRequest
The authorization mechanism you have provided is not supported. Please use Signature Version 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 访问点来完成这样的任务,或者它不适用于 public 访问(静态网站)?如果可能的话,我是否遗漏了什么 - 也许 S3AccessPoint 需要自己的 IAM 访问策略?
我使用 S3 访问点的主要动机是在不使用 Route 53 和自定义域的情况下隐藏原始存储桶名称。
很遗憾,您不能这样做,因为 S3 网站模式仅适用于存储桶(不是访问点)。来自 docs:
Amazon S3 website endpoints do not support HTTPS or access points.
我正在尝试弄清楚是否可以使用 AWS S3 访问点来托管静态 S3 网站。
S3WebsiteBucket.WebsiteURL
下面描述的资源很好用,但我需要改用 Access Point。
每当我请求索引文件时的失败消息(URL 类似于 https://my-access-point-0000000000.s3-accesspoint.eu-north-1.amazonaws.com/index.html)如下:
InvalidRequest The authorization mechanism you have provided is not supported. Please use Signature Version 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 访问点来完成这样的任务,或者它不适用于 public 访问(静态网站)?如果可能的话,我是否遗漏了什么 - 也许 S3AccessPoint 需要自己的 IAM 访问策略?
我使用 S3 访问点的主要动机是在不使用 Route 53 和自定义域的情况下隐藏原始存储桶名称。
很遗憾,您不能这样做,因为 S3 网站模式仅适用于存储桶(不是访问点)。来自 docs:
Amazon S3 website endpoints do not support HTTPS or access points.