默认情况下,Amazon S3公开给用户“Everyone”

时间:2015-02-17 20:30:02

标签: amazon-web-services amazon-s3

我已经遵循了S3文档,并且默认情况下无法允许公共访问。

以下是我应用于存储分区策略的代码:

{
"Version": "2008-10-17",
"Id": "Policy1424204422650",
"Statement": [
    {
        "Sid": "Stmt1424204398740",
        "Effect": "Allow",
        "Principal": {
            "AWS": "*"
        },
        "Action": "s3:GetObject",
        "Resource": "arn:aws:s3:::images/*"
    }
]
}

我尝试将原则更改为“Everyone”,但AWS会返回以下错误:

Invalid principal in policy - "AWS" : "Everyone"

我如何修改JSON以默认允许访问所有人?

1 个答案:

答案 0 :(得分:2)

S3 example bucket policies有正确的政策 - 我每隔几个月就会谷歌一次。

{
  "Version":"2012-10-17",
  "Statement":[{
    "Sid":"AddPerm",
    "Effect":"Allow",
    "Principal": "*",
    "Action":["s3:GetObject"],
    "Resource":["arn:aws:s3:::examplebucket/*"]
  }]
}

你应该改变一件事,那就是examplebucket

注意主体是"*",它不是哈希/字典。