Skip to content

Instantly share code, notes, and snippets.

@mvneves
Created July 16, 2018 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvneves/5b63b224b56b658a163959cd5d3f0203 to your computer and use it in GitHub Desktop.
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
{
"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