Created
October 19, 2017 22:50
-
-
Save rdp-cloud/16a4330282c251e6cace08f6a49a5135 to your computer and use it in GitHub Desktop.
Example AWS IAM Security Policy to enforce tag usage during deployment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"ec2:RunInstances" | |
], | |
"Resource": [ | |
"*" | |
] | |
}, | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"ec2:CreateTags" | |
], | |
"Resource": "arn:aws:ec2:*:*:instance/*", | |
"Condition": { | |
"StringEquals": { | |
"ec2:CreateAction": "RunInstances" | |
} | |
} | |
}, | |
{ | |
"Effect": "Deny", | |
"Action": [ | |
"ec2:RunInstances" | |
], | |
"Resource": [ | |
"arn:aws:ec2:*:*:instance/*" | |
], | |
"Condition": { | |
"Null": { | |
"aws:RequestTag/costcenter": "true" | |
} | |
} | |
}, | |
{ | |
"Effect": "Deny", | |
"Action": "ec2:RunInstances", | |
"Resource": "*", | |
"Condition": { | |
"ForAnyValue:StringNotEquals": { | |
"aws:RequestTag/costcenter": [ | |
"1", | |
"2", | |
"3" | |
] | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment