如何将s3:ListBucket权限添加到我的S3存储桶策略中

时间:2015-03-16 15:24:44

标签: amazon-web-services amazon-s3

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

我已尝试将行动路线更改为 -

"Action":
[
"s3:GetObject",
"s3:ListBucket",
],

但仍然没有运气!我做错了什么?

1 个答案:

答案 0 :(得分:0)

你的括号有点偏。将来,您可以使用policy generator来帮助创建需要更复杂参数的策略。类似于以下内容应该有助于满足您的要求。

{
  "Id": "Policy1426519951124",
  "Statement": [
    {
      "Sid": "Stmt1426519948229",
      "Action": [
        "s3:GetObject",
        "s3:ListBucket"
      ],
      "Effect": "Allow",
      "Resource": "arn:aws:s3:::bucket_name_here/",
      "Principal": "*"
    }
  ]
}