S3政策无效的操作 - S3:ListAllMyBuckets(s3 Policy has inv

2019-07-04 06:55发布

我想这些政策通过console.aws.amazon.com我的水桶:


    {
      "Statement": [
        {
          "Effect": "Allow",
          "Action": [
            "s3:ListBucket",
            "s3:GetBucketLocation",
            "s3:ListBucketMultipartUploads"
          ],
          "Resource": "arn:aws:s3:::itnighq",
          "Condition": {}
        },
        {
          "Effect": "Allow",
          "Action": [
            "s3:AbortMultipartUpload",
            "s3:DeleteObject",
            "s3:DeleteObjectVersion",
            "s3:GetObject",
            "s3:GetObjectAcl",
            "s3:GetObjectVersion",
            "s3:GetObjectVersionAcl",
            "s3:PutObject",
            "s3:PutObjectAcl",
            "s3:PutObjectAclVersion"
          ],
          "Resource": "arn:aws:s3:::itnighq/*",
          "Condition": {}
        },
        {
          "Effect": "Allow",
          "Action": "s3:ListAllMyBuckets",
          "Resource": "*",
          "Condition": {}
        }
      ]
    }

但我发现了这个错误信息: 政策无效的行动- S3:似乎ListAllMyBuckets它不喜欢的“资源”:“*”,我也试着使用** ARN:AWS:S3 ::: * ***,但它也不管用。

任何人有任何线索?

Answer 1:

作为zdev提到的,你需要为IAM做到这一点。 转至IAM控制台并导航到用户>权限>在线政策>新建>自定义 ,然后输入:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListAllMyBuckets"
            ],
            "Resource": [
                "arn:aws:s3:::*"
            ]
        }
    ]
}


Answer 2:

我想通了自己。 它需要在做IAM ,而不是在S3本身...



Answer 3:

@dnlbrky你需要通过设置为IAM用户/组/角色的政策要做到这一点,并通过对IAM用户/组的AWS控制台或者或致电put_ [角色/用户/组] _policy博托API调用设置。



文章来源: s3 Policy has invalid action - s3:ListAllMyBuckets