我正在尝试为名为files.mybucket.com的全新漂亮存储桶设置一个策略,该策略指出:
这是我到目前为止尝试过的:
"Statement": [
{
"Sid": "getAll",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": [
"arn:aws:s3:::files.mybucket.com",
"arn:aws:s3:::files.mybucket.com/*"
]
},
{
"Sid": "writeSome",
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::111111111111:user/John",
"arn:aws:iam::111111111111:user/Dave"
]
},
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::files.mybucket.com",
"arn:aws:s3:::files.mybucket.com/*"
]
}
]
以上内容似乎无效:即使我从语句中删除“ John”主体,我仍然可以通过控制台和Cloudberry Explorer将其上载。
"Statement": [
{
"Sid": "getAll",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": [
"arn:aws:s3:::files.mybucket.com",
"arn:aws:s3:::files.mybucket.com/*"
]
},
{
"Sid": "writeSome",
"Effect": "Deny",
"NotPrincipal": {
"AWS": [
"arn:aws:iam::111111111111:user/John",
"arn:aws:iam::111111111111:user/Dave"
]
},
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::files.mybucket.com",
"arn:aws:s3:::files.mybucket.com/*"
]
}
]
这个看起来很有希望,因为它可以阻止用户进行书写(如果我删除了John,我将无法再使用它了),但是它也阻止了未经身份验证的人的获取请求(并且我希望他们能够看到其内容)
所以,问题是:如何让人们获取我的文件,并阻止除约翰和戴夫之外的所有人在水桶上写字?
这让我发疯。感谢您的帮助。
答案 0 :(得分:0)
一般规则:
因此:
这避免了总是会引起问题的Deny
策略的需要。