Search code examples
amazon-web-servicesfilteramazon-sns

AWS SNS Message filtering on 'OR' condition


On the SNS Message filtering page there is an example for AND/OR Logic as follows

AND logic : Apply AND logic by using multiple attribute names (keys). For example, the policy:

{
    "customer_interests": ["rugby"],
    "price_usd": [{"numeric":[">", 100]}]
}

OR logic : Apply OR logic by assigning multiple values to an attribute name. For example, the policy attribute:

"customer_interests": ["rugby", "football", "baseball"]

However how can we apply 'OR' logic for multiple attribute names (keys)

So for example what will be the policy if I want to change the first example

From

(customer_interests="rugby" AND price_usd > 100)

To

(customer_interests="rugby" OR price_usd > 100)


Solution

  • As of Nov 2023, you can now use the “OR” operator in SNS filter policies. More information: https://aws.amazon.com/about-aws/whats-new/2023/11/amazon-sns-message-additional-filtering-operators/