1

我希望能够允许通过 IAM 创建的用户能够在管理控制台中查看一个特定的存储桶。此外,我想将它限制在存储桶中的一个文件夹中,这样权限将是:

对我的存储桶/文件夹/* 的 S3 控制台访问

我将如何使用策略生成器来做到这一点?我目前有:

{
   "Statement": [
    {
      "Effect": "Allow",
      "Action": "s3:*",
      "Resource": "*"
    }
  ]
}

但是,当我修改资源位置时arn:aws:s3:::my-bucket/folder——它会阻止用户完全使用控制台。这有可能吗?我需要做什么才能解决这个问题?

4

1 回答 1

1

这个政策让我想起了做欧拉近似,但这就是我做的(用注释来解释):

{
  "Statement": [
{             // first, allow unlimited access for S3
  "Effect": "Allow",  
  "Action": "s3:*",
  "Resource": "*"
},
{             // second, deny access to all buckets except for the particular bucket
  "Action": [
    "s3:*"
  ],
  "Effect": "Deny",
  "Resource": [
    list-of-my-other-buckets
  ]
},
{             // third, since we've already given * permissions, the bucket has full 
              // permissions, and we need to restrcit all the permissions we don't want to give
  "Action": [
    "s3:AbortMultipartUpload",
    "s3:CreateBucket",
    "s3:DeleteBucket",
    "s3:DeleteObject",
    "s3:DeleteObjectVersion",
    "s3:GetBucketAcl",
    "s3:GetBucketNotification",
    "s3:GetBucketPolicy",
    "s3:GetBucketRequestPayment",
    "s3:GetObjectAcl",
    "s3:GetObjectVersion",
    "s3:GetObjectVersionAcl",
    "s3:PutBucketAcl",
    "s3:PutBucketNotification",
    "s3:PutBucketPolicy",
    "s3:PutBucketRequestPayment",
    "s3:PutBucketVersioning",
    "s3:PutObjectAcl",
    "s3:PutObjectVersionAcl"
  ],      
  "Effect": "Deny",
  "Resource": [
    "arn:aws:s3:::my-bucket/*"
          ]
        }
    ]
}
于 2011-10-13T03:53:18.303 回答