无法在S3存储桶中授予公共读取权限

时间:2019-10-30 23:46:50

标签: amazon-web-services amazon-s3

我试图了解我需要在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%是否已获得权限。我需要做的就是公开访问我的照片(以便我的网站可以抓取它们),并拒绝其他任何内容(除了我登录并上传更多照片外)。

0 个答案:

没有答案