I have a bunch of files that I would like to put on S3 such that access to them is restricted only to a particular IAM user. I've tried associating a policy with the user, and with the bucket, and am trying to access a file in the bucket using s3-cmd. However, I keep getting the access denied xml in the response (403 forbidden). My policy looks like this:
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "<a statementID>",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<my-account-num>:user/<username>"
},
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::<bucket-name>/*",
"arn:aws:s3:::<bucket>"
]
}
]
}
Only if I set the Principal to "AWS": "*", am I able to download the resource through the REST calls.
The user in question has the "Power User" policy attached to it:
{
"Statement": [
{
"Effect": "Allow",
"NotAction": "iam:*",
"Resource": "*"
}
]
}
How do I use an S3 bucket for private-only access? Please help.