我尝试允许我们的Devs(myapp-dev1)访问一个显式的S3-Bucket。
我创建了一个允许CRUD选项的策略(他应该能够将图像文件写入和读取到该存储桶中,并且只能写入该存储区。
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject",
"s3:ListObjects"
我创建了一个名为dev1的用户并将其分配给该新策略(该用户不在一个组中,也没有一个角色)
ARN: arn:aws:s3:::myapp-dev1-bucket
然后在这个桶中我切换到“Bucket Policy”并使用了“Policy Generator”并允许每个操作。到目前为止,所有其他设置都失败了。它看起来像这样:
{
"Id": "Policy123456789",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt123456789",
"Action": "s3:*",
"Effect": "Allow",
"Resource": "arn:aws:s3:::myapp-dev1-bucket",
"Principal": {
"AWS": [
"arn:aws:iam::1234567890:user/myapp-dev1"
]
}
}
]
}
但我还是得到了
Excon :: Error :: Forbidden:Expected(200)< =>实际(403禁止)
请帮忙!
答案 0 :(得分:0)
试试这个,
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::Bucket_Name"
]
},
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject",
"s3:ListObject"
],
"Resource": [
"arn:aws:s3:::Bucket_Name/*"
]
}
]
}