【发布时间】:2019-06-13 01:05:19
【问题描述】:
我想对我的 Bucket 中 serverless.yml 文件的“public”文件夹中的所有项目启用公共读取访问权限。
目前这是我用来声明我的存储桶的定义代码。它是从一个无服务器堆栈示例中复制和粘贴的。
Resources:
AttachmentsBucket:
Type: AWS::S3::Bucket
Properties:
AccessControl: PublicRead
# Set the CORS policy
BucketName: range-picker-bucket-${self:custom.stage}
CorsConfiguration:
CorsRules:
-
AllowedOrigins:
- '*'
AllowedHeaders:
- '*'
AllowedMethods:
- GET
- PUT
- POST
- DELETE
- HEAD
MaxAge: 3000
# Print out the name of the bucket that is created
Outputs:
AttachmentsBucketName:
Value:
Ref: AttachmentsBucket
现在,当我尝试使用文件的 url 时,它返回访问被拒绝。我必须在 aws-s3 Web 界面中手动设置每个文件的公共读取权限。
我做错了什么?
【问题讨论】:
标签: amazon-s3 serverless