我试图了解我需要在Amazon S3存储桶上设置的特定权限。我已经在寻找这些信息,但是只看到了亚马逊实施的新ACL /策略的1或2个示例。
我的用例:我正在使用S3为我的网站(托管在其他地方)存储图像。我想在S3上上传图像,并能够通过我自己网站上的链接访问它们。
我已经使用https://awspolicygen.s3.amazonaws.com/policygen.html来生成GetObject策略:
{
"Id": "Policyxxxxxxxxxxxxxxxxx",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmtxxxxxxxxxxxxxxx",
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::xxxxxx-xxxxx-xxxxxxx/*",
"Principal": "*"
}
]
}
这些是我当前的Block public access
设置:
Block all public access: Off
Block public access to buckets and objects granted through new access control lists (ACLs): On
Block public access to buckets and objects granted through any access control lists (ACLs): On
Block public access to buckets and objects granted through new public bucket policies: Off
Block public and cross-account access to buckets and objects through any public bucket policies: Off
在Access Control List
中,我没有添加任何权限。
在Bucket Policy
中,我放置了生成的策略。
在CORS configuration
中,我将localhost和域名指定为允许的来源,而将GET指定为允许的方法。
这对我的用法正确吗?它目前可以使用,但是我不确定100%是否已获得权限。我需要做的就是公开访问我的照片(以便我的网站可以抓取它们),并拒绝其他任何内容(除了我登录并上传更多照片外)。