I'm attempting to modify an IAM Policy so that users can associate an IAM Role with EC2 instances that allows Read Only rights to our S3 buckets.
Our teams do quite a bit of R&D with AWS, and so I'm loathe to restrict access to any AWS services except for IAM, which would allow escalation of privileges.
I've used the information in this question to add the iam:PassRole, but the policy fails to validate in the simulator.
{
"Statement": [
{
"Effect": "Allow",
"NotAction": "iam:*",
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "iam:PassRole",
"Resource": "arn:aws:iam::ACCOUNTID:role/MYROLE"
}
]
}
If I change the Resource of the second statement to "Resource": "*"
validation succeeds and the simulator shows that PassRole is explicitly allowed, everything else in IAM is implicitly denied, and everything in S3 is explicitly allowed.
What am I doing wrong with the named role? What could the security implications be by allowing PassRole for all (I'm assuming the policy simulator isn't fibbing). Is there a better way to achieve what I want?