I'm attempting to introduce a guest IAM policy to restrict the access to the EC2
instances.
I'm trying to reach that, the guest policy shows only that instances, which is not tagged with 'Department' or tagged with 'Department = Guest'.
Here is the policy, that I made for this:
Policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:Describe*"
],
"Resource": "*",
"Condition": {
"StringEquals": {
"ec2:ResourceTag/Department": "Guest"
},
"Null": {
"ec2:ResourceTag/Department": "true"
}
}
}
]}
The "Department = Guest"
comparison is working well, but the Resource Tag existence check is not working.
Is there any other way to list the instances, which haven't got 'Department' tag?