Reputation: 47
Scenario: There are 3 AWS accounts on our infra. Only in 1 account has IAM users are created. They use Switch role to login to other accounts.
Now there's one S3 bucket in account where IAM users are created but when IAM users use switch role to login to other accounts they can't see S3 bucket.
Below is inside S3 bucket policy: As you can see we have given permissions of s3:ListBucket and s3:GetObject to roles which are present in other accounts.
{
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::975062884610:role/dev-switch-role",
"arn:aws:iam::243225358771:role/prod-switch-role"
]
},
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::logs-s3-bucket"
},
{
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::975062884610:role/dev-switch-role",
"arn:aws:iam::243225358771:role/prod-switch-role"
]
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::logs-s3-bucket/*"
}
Also in Role policies roles have AdministratorAccess policy attached but still IAM users can't view buckets after using switching role to login into other accounts.
Upvotes: 1
Views: 399
Reputation: 269091
Let's say you have:
When granting cross-account access to an Amazon S3 bucket, you need to grant BOTH of the following:
Therefore, my guess would be that the non-functioning role(s) have not been given permission to Access the S3 bucket in Account-B.
You might be wondering why you require BOTH sets of permissions. It is because:
Upvotes: 0