Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Key matching

Focus mode
Key matching - Amazon Simple Notification Service

Use the exists operator in a filter policy to match incoming messages based on whether a specific property is present or absent.

  • exists works only on leaf nodes (final attributes in the structure).

  • It does not apply to intermediate nodes within a nested JSON structure.

  • Use "exists": true to match incoming messages that include the specified property. The key must have a non-null and non-empty value.

    For example, the following policy property uses the exists operator with a value of true:

    "store": [{"exists": true}]

    It matches any list of message attributes that contains the store attribute key, such as the following:

    "store": {"Type": "String", "Value": "fans"} "customer_interests": {"Type": "String.Array", "Value": "[\"baseball\", \"basketball\"]"}

    It also matches either of the following message body:

    { "store": "fans" "customer_interests": ["baseball", "basketball"] }

    However, it doesn't match any list of message attributes without the store attribute key, such as the following:

    "customer_interests": {"Type": "String.Array", "Value": "[\"baseball\", \"basketball\"]"}

    Nor does it match the following message body:

    { "customer_interests": ["baseball", "basketball"] }
  • Use "exists": false to match incoming messages that don't include the specified property.

    Note

    "exists": false only matches if at least one attribute is present. An empty set of attributes results in the filter not matching.

    For example, the following policy property uses the exists operator with a value of false:

    "store": [{"exists": false}]

    It doesn't match any list of message attributes that contains the store attribute key, such as the following:

    "store": {"Type": "String", "Value": "fans"} "customer_interests": {"Type": "String.Array", "Value": "[\"baseball\", \"basketball\"]"}

    It also doesn’t match the following message body:

    { "store": "fans" "customer_interests": ["baseball", "basketball"] }

    However, it matches any list of message attributes without the store attribute key, such as the following:

    "customer_interests": {"Type": "String.Array", "Value": "[\"baseball\", \"basketball\"]"}

    It also matches the following message body:

    { "customer_interests": ["baseball", "basketball"] }
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.