I'm trying to apply an AWS Service Control Policy that prevents the creation of an EC2 instance unless a specific tag is provided in the request.
Why is the following SCP denying the creation of an EC2 instance (with an ENI & EBS volume) under, from what I can tell, all circumstances, even if I provide the required tag? (FYI, I am creating the instance from the AWS Console and am adding the tag in the request.) Without this policy applied, I am able to create the instance successfully.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "RequireEnvironmentTag",
"Effect": "Deny",
"Action": [
"ec2:CreateTags",
"ec2:RunInstances"
],
"Resource": "*",
"Condition": {
"ForAllValues:StringNotEquals": {
"aws:TagKeys": "sc:environment"
}
}
}
]
}
