I'm really flailing around in AWS trying to figure out what I'm missing here. I'd like to make it so that an IAM user can download files from an S3 bucket - without just making the files totally public - but I'm getting access denied. If anyone can spot what's off I'll be stoked.
What I've done so far:
- Created a user called my-user (for sake of example)
- Generated access keys for the user and put them in ~/.aws on an EC2 instance
- Created a bucket policy that I'd hoped grants access for my-user
- Ran the command
aws s3 cp --profile my-user s3://my-bucket/thing.zip .
Bucket policy:
{
"Id": "Policy1384791162970",
"Statement": [
{
"Sid": "Stmt1384791151633",
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::my-bucket/*",
"Principal": {
"AWS": "arn:aws:iam::111122223333:user/my-user"
}
}
]
}
The result is A client error (AccessDenied) occurred: Access Denied
although I can download using the same command and the default (root account?) access keys.
I've tried adding a user policy as well. While I don't know why it would be necessary I thought it wouldn't hurt, so I attached this to my-user.
{
"Statement": [
{
"Sid": "Stmt1384889624746",
"Action": "s3:*",
"Effect": "Allow",
"Resource": "arn:aws:s3:::my-bucket/*"
}
]
}
Same results.