Back to all operators

ForAllValues:StringLikeIfExists

ForAllValues:StringLikeIfExists

compares a list of strings in a request to a list of strings in your policy. The policy values can include asterisks (*) to match multiple characters and question marks (?) to match a single character. The comparison is case sensitive.

To match a request, the context key can be absent, but if it is present, all of the strings in the request must match at least one of the strings in your policy.

You can use policy variables in the value of this operator.

Warning

ForAllValues:StringLikeIfExists is actively confusing. Any operator starting with ForAllValues ignores IfExists — it is not evaluated against the entire array, only against a single value at a time inside the ForAllValues loop. Use ForAllValues:StringLike instead so your coworkers don't hate you.

ForAllValues:StringLikeIfExists in an Allow Statement

Simulate in IAM Simulate
Policy ConditionRequest ContextResult
"ForAllValues:StringLikeIfExists": {
"aws:TagKeys": [
"Owner:*",
"State:??"
]
}
aws:TagKeys: null✓ Allowed Assuming no explicit Deny elsewhere
"ForAllValues:StringLikeIfExists": {
"aws:TagKeys": [
"Owner:*",
"State:??"
]
}
aws:TagKeys:
 - owner:Mktg
 - State:NewYork
− Not Allowed Statement does not apply
"ForAllValues:StringLikeIfExists": {
"aws:TagKeys": [
"Owner:*",
"State:??"
]
}
aws:TagKeys:
 - Owner:Legal
 - owner:Mktg
− Not Allowed Statement does not apply
"ForAllValues:StringLikeIfExists": {
"aws:TagKeys": [
"Owner:*",
"State:??"
]
}
aws:TagKeys:
 - Owner:Legal
✓ Allowed Assuming no explicit Deny elsewhere
"ForAllValues:StringLikeIfExists": {
"aws:TagKeys": [
"Owner:*",
"State:??"
]
}
aws:TagKeys:
 - Owner:Legal
 - State:NY
✓ Allowed Assuming no explicit Deny elsewhere
"ForAllValues:StringLikeIfExists": {
"aws:TagKeys": [
"Owner:*",
"State:??"
]
}
aws:TagKeys:
 - Owner:Legal
 - State:NY
 - owner:Mktg
− Not Allowed Statement does not apply

ForAllValues:StringLikeIfExists in a Deny Statement

Simulate in IAM Simulate
Policy ConditionRequest ContextResult
"ForAllValues:StringLikeIfExists": {
"aws:TagKeys": [
"Owner:*",
"State:??"
]
}
aws:TagKeys: null✕ Denied
"ForAllValues:StringLikeIfExists": {
"aws:TagKeys": [
"Owner:*",
"State:??"
]
}
aws:TagKeys:
 - owner:Mktg
 - State:NewYork
− Not Denied May be allowed by another statement
"ForAllValues:StringLikeIfExists": {
"aws:TagKeys": [
"Owner:*",
"State:??"
]
}
aws:TagKeys:
 - Owner:Legal
 - owner:Mktg
− Not Denied May be allowed by another statement
"ForAllValues:StringLikeIfExists": {
"aws:TagKeys": [
"Owner:*",
"State:??"
]
}
aws:TagKeys:
 - Owner:Legal
✕ Denied
"ForAllValues:StringLikeIfExists": {
"aws:TagKeys": [
"Owner:*",
"State:??"
]
}
aws:TagKeys:
 - Owner:Legal
 - State:NY
✕ Denied
"ForAllValues:StringLikeIfExists": {
"aws:TagKeys": [
"Owner:*",
"State:??"
]
}
aws:TagKeys:
 - Owner:Legal
 - State:NY
 - owner:Mktg
− Not Denied May be allowed by another statement