I have a bucket with several files publicly downloadable. I want to put up a bucket policy after which these files should only be downloadable by my IAM users. The policy I have got so far is this:
{
"Version": "2008-10-17",
"Id": "Policy1424952346041",
"Statement": [
{
"Sid": "Stmt1424958477350",
"Effect": "Deny",
"NotPrincipal": {
"AWS": "arn:aws:iam::777777777777:root"
},
"Action": "s3:*",
"Resource": "arn:aws:s3:::test/*"
},
{
"Sid": "Stmt1424958477351",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::777777777777:root"
},
"Action": "s3:*",
"Resource": "arn:aws:s3:::test/*"
}
]
}
However, it is denying everyone including the IAM users. Can anyone please point out what is wrong here?