I'm trying to protect my AWS resources through a tag (without values)
Below is the example snippet of the IAM policy that I am using.
This doesn't seem to work!
{
"Action": [
"s3:DeleteObject"
],
"Resource": "*",
"Effect": "Deny",
"Sid": "ProtectResource",
"Condition": {
"StringEquals": {
"aws:TagKeys": "ProtectionTag"
}
}
}
If I change "StringEquals" to "ForAllValues:StringEquals", then it works but the protection stays even when the tag is removed.
Can you help me construct a condition that helps me protect the resource based on a tag alone. Optionally, I am fine with providing values if that is required to construct the condition.
Thanks.
