Created
July 16, 2018 21:33
-
-
Save mvneves/5b63b224b56b658a163959cd5d3f0203 to your computer and use it in GitHub Desktop.
AWS policy to limit EC2 usage to a specific region and instance type
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": [ | |
{ | |
"Sid": "limitedRegion", | |
"Action": "ec2:*", | |
"Resource": "*", | |
"Effect": "Allow", | |
"Condition": { | |
"StringEquals": { | |
"ec2:Region": "us-east-1" | |
} | |
} | |
}, | |
{ | |
"Sid": "limitedSize", | |
"Effect": "Deny", | |
"Action": "ec2:RunInstances", | |
"Resource": "arn:aws:ec2:*:*:instance/*", | |
"Condition": { | |
"ForAnyValue:StringNotLike": { | |
"ec2:InstanceType": [ | |
"t2.micro" | |
] | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment