# CloudWatch alarm: SNS NumberOfNotificationsFilteredOut-InvalidAttributes

CloudWatch alarms · Updated 16 November 2026

**Short answer:** Alarm on AWS/SNS NumberOfNotificationsFilteredOut-InvalidAttributes per TopicName with the Sum over 60 seconds, firing when it is above 0 for 5 of 5 minutes. These are messages that a subscription's attribute-based filter policy could not evaluate because the message attributes themselves were malformed, which nearly always means a publisher bug.

## Filtered out versus invalid

Subscription filter policies are meant to drop messages, so `NumberOfNotificationsFilteredOut` going up is usually fine. The `-InvalidAttributes` variant is different: SNS rejected the message for a subscription because its message attributes could not be evaluated, for example malformed attribute values or the wrong data type. The subscriber does not get the message, and nothing tells the publisher.

Common real causes: a publisher building the attribute map by hand and sending a number as a string type (or the reverse), a JSON-encoded array attribute that is not valid JSON, an SDK upgrade that changed how attributes are serialised, or a new publisher that never followed the attribute contract.

The metric only matters for topics with attribute-based filter policies on at least one subscription.

## Recommended alarm settings

| Setting | Recommended value |
|---|---|
| Namespace | `AWS/SNS` |
| Metric | `NumberOfNotificationsFilteredOut-InvalidAttributes` |
| Dimensions | TopicName |
| Statistic | Sum |
| Threshold | 0.0 |
| Period | 60 seconds |
| Datapoints to alarm | 5 |
| Evaluation periods | 5 |
| Comparison operator | `GreaterThanThreshold` |

With 5 of 5 one-minute datapoints, the alarm needs invalid messages in every minute for five minutes. A publisher that only sends occasionally can break without ever tripping it; for low-volume topics use 1 of 1, since invalid attributes are never expected.

## Tuning and related metrics

There is no normal level of invalid attributes, so tuning is about the window, not the threshold. On busy topics the 5-of-5 window is fine; on quiet ones, use 1 of 1 or a longer period such as five minutes, so a single bad publish still produces a datapoint above zero.

Graph the metric next to `NumberOfNotificationsFilteredOut` and `NumberOfNotificationsDelivered`. A rise in invalid attributes with a matching fall in deliveries confirms subscribers are missing messages; a rise with no change in deliveries suggests the affected subscription receives little traffic anyway.

## Create the alarm

```
aws cloudwatch put-metric-alarm \
  --alarm-name sns-order-events-invalid-attributes \
  --alarm-description "Messages on order-events with invalid attributes for filtering" \
  --namespace AWS/SNS \
  --metric-name NumberOfNotificationsFilteredOut-InvalidAttributes \
  --dimensions Name=TopicName,Value=order-events \
  --statistic Sum \
  --period 60 \
  --evaluation-periods 5 \
  --datapoints-to-alarm 5 \
  --threshold 0 \
  --comparison-operator GreaterThanThreshold \
  --treat-missing-data notBreaching \
  --alarm-actions arn:aws:sns:eu-west-2:123456789012:oncall-alerts
```

## When it fires

1. **Identify the publisher.** If several services publish to the topic, check which deployed recently; CloudTrail does not log message content, so application logs are the best source.

2. **Capture an example:** temporarily subscribe an SQS queue without a filter policy and inspect the `MessageAttributes` of incoming messages.

3. **Compare with the filter policies** on the subscriptions:

   ```
   aws sns get-subscription-attributes \
     --subscription-arn arn:aws:sns:eu-west-2:123456789012:order-events:0123abcd-4567-89ef-0123-456789abcdef \
     --query "Attributes.FilterPolicy"
   ```

4. **Fix the publisher** to send correctly typed attributes, and consider validating attributes in a shared client library.

## Questions

### What does a CloudWatch alarm SNS message look like?

The message body is JSON with fields such as AlarmName, AlarmDescription, NewStateValue, NewStateReason, OldStateValue, StateChangeTime, Region and a Trigger object describing the metric, statistic and threshold.

### Is NumberOfNotificationsFilteredOut a problem?

Usually not; it counts messages that simply did not match a filter policy. The -InvalidAttributes and -InvalidMessageBody variants indicate malformed messages and are worth alarming on.

## When this happens away from your desk

Invalid attributes mean a subscriber is quietly missing messages, which usually traces back to a recent publisher change. CloudConsole, a phone app for AWS, is built to show this alarm with its start time on your phone so you can match it to a deploy.

[About the CloudConsole app](https://cloudconsole.dev/aws-console-app) · [Download on the App Store](https://apps.apple.com/app/cloudconsole-for-aws/id6835419710)

## Sources

- [Recommended alarms (Amazon CloudWatch User Guide)](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Best_Practice_Recommended_Alarms_AWS_Services.html)
- [Amazon SNS message filtering](https://docs.aws.amazon.com/sns/latest/dg/sns-message-filtering.html)
- [Monitoring Amazon SNS topics using CloudWatch](https://docs.aws.amazon.com/sns/latest/dg/sns-monitoring-using-cloudwatch.html)

## Related

- [CloudWatch alarm: SNS NumberOfNotificationsFilteredOut-InvalidMessageBody](https://cloudconsole.dev/alarms/sns-numberofnotificationsfilteredout-invalidmessagebody)
- [CloudWatch alarm: SNS NumberOfNotificationsDelivered (too low)](https://cloudconsole.dev/alarms/sns-numberofnotificationsdelivered)
- [CloudWatch alarm: SNS NumberOfMessagesPublished (too low)](https://cloudconsole.dev/alarms/sns-numberofmessagespublished)
- [aws sqs receive-message](https://cloudconsole.dev/cli/sqs-receive-message)
- [How to get CloudWatch alarm email notifications](https://cloudconsole.dev/how-to/cloudwatch-alarm-email-notification)
- [CloudWatch alarm: SNS NumberOfNotificationsFailed](https://cloudconsole.dev/alarms/sns-numberofnotificationsfailed)

---

Source: https://cloudconsole.dev/alarms/sns-numberofnotificationsfilteredout-invalidattributes

CloudConsole is an independent iPhone and Android app for Amazon Web Services by Cloudconcur Ltd. It is not affiliated with Amazon Web Services.
