How do I troubleshoot subscription filter policy issues in Amazon SNS?

Last updated: 2021-08-26

My Amazon Simple Notification Service (Amazon SNS) subscription filter policy isn't working. How do I troubleshoot the issue?

Resolution

Important: Additions or changes to a subscription filter policy require up to 15 minutes to take effect.

Verify that message attributes are included in the messages published to your Amazon SNS topic

Subscription filter policies can filter message attributes only, not the message body. If the MessageAttributeValue is left empty on a message, then the filter policy rejects the message.

To see if your filter policy rejected messages because they didn't include attributes, review the following metric in your Amazon CloudWatch metrics for Amazon SNS:

NumberOfNotificationsFilteredOut-NoMessageAttributes

For more information, see Amazon SNS message filtering. For a tutorial on how to send messages with attributes, see To publish messages to Amazon SNS topics using the AWS Management Console.

Verify that the messages published to your Amazon SNS topic meet the required filter policy constraints

For a complete list of restraints, see Filter policy constraints.

Verify that your subscription filter policy's attributes are configured correctly

After you define a subscription filter policy's attributes, the subscription endpoint receives only messages that include those defined attributes. For more information see, Attribute string value matching and Attribute numeric value matching.

To see the messages that your filter policy rejected because of mismatching or incorrectly formatted attributes, review the following CloudWatch metrics for Amazon SNS:

  • NumberOfNotificationsFilteredOut
  • NumberOfNotificationsFilteredOut-InvalidAttributes

Note: The NumberOfNotificationsFilteredOut metric shows messages that your filter policy rejected because the message attributes didn’t match the policy attributes. The NumberOfNotificationsFilteredOut-InvalidAttributes metric shows messages that your filter policy rejected because the message attributes weren't in a valid format.


Did this article help?


Do you need billing or technical support?