I have a bucket "mybucket" in which there is a folder "myfolder". In the same bucket there is also another folder "notmyfolder".
This is the policy that I think "should" work.
{
"Statement": [
{
"Action": [
"s3:GetObject"
],
"Condition": {
"StringLike": {
"s3:prefix": [
"myfolder",
"myfolder/*"
]
}
},
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::mybucket"
]
}
]
}
But testing with the policy simulator trying to do GetObject on a file in myfolder gets denied.
If I change it to
{
"Statement": [
{
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::pangea-configuration/myfolder/*"
]
}
]
}
Now the simulator says I can access the file in myfolder. But it also lets me access a file in notmyfolder.
what am I missing here?