- Developers want to launch personal resources for developing code
- Developers need to embed personal credentials for external services like databases into the services they launch, either by supplying EC2 user data at launch or via a resource config file like the EMR config file
- You do not want developers to see any resources or sensitive information other than their own
- You want an account admin to be able see all resources even if that admin is not an account owner
Therefore the only modifications needed were
- Allow users to add a limited set of IAM roles to EC2 instances
- Prevent users from seeing EMR service information for clusters they did not launch
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "statement1",
"Condition": {
"StringEquals": {
"elasticmapreduce:RequestTag/owner": "${aws:username}"
}
},
"Effect": "Allow",
"Action": [
"iam:PassRole",
"iam:AddRoleToInstanceProfile"
],
"Resource": [
"arn:aws:iam::012345678910:role/EMR_DefaultRole",
"arn:aws:iam::012345678910:role/EMR_EC2_DefaultRole"
]
},
{
"Sid": "statement2",
"Condition": {
"StringNotEquals": {
"elasticmapreduce:ResourceTag/owner": "${aws:username}"
}
},
"Effect": "Deny",
"Action": [
"elasticmapreduce:AddTags",
"elasticmapreduce:Describe*"
],
"Resource": [
"*"
]
}
]
}
The key to tag-based authorization that was always missing from the picture in my mind was the RequestTag element and an IAM policy variable within a conditional allow statement. Statement 1 above effectively states that a developer is only allowed these elevated IAM privileges if he or she puts a tag on their resource request where tag name = owner and tag value = their username. This means they must put their username on every EMR resource request they make or the request will fail. Statement 2 above denies the developer the ability to add or remove tags, or to describe EMR resource unless the resource contains a tag where tag name = owner and tag value = their username.
No comments:
Post a Comment