我希望制定拒绝访问所有存储桶的策略,除了以特定命名约定开头的存储桶,即如果它们以“xyz”开头。我怎样才能写一个政策来做到这一点?下面的一个有效,但它会引发各种警告:
“您选择需要存储桶资源类型的操作”或“一个或多个操作可能不支持此资源”或“您的策略中的操作不支持资源级别权限并要求您选择所有权限。
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetBucketLocation",
"s3:ListAllMyBuckets",
"s3:CreateBucket"
],
"Resource": "arn:aws:s3:::*"
},
{
"Effect": "Allow",
"Action": [
"s3:PutBucketPublicAccessBlock",
"s3:PutEncryptionConfiguration",
"s3:PutObject",
"s3:PutObjectAcl",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:DeleteObject"
],
"Resource": [
"arn:aws:s3:::xyz*",
"arn:aws:s3:::xyz*/*"
]
}
]
}