SNS message filtering lets each subscriber receive only the messages it cares about, using filter policies on message attributes — so you don’t send every message to every subscriber.
Why it matters
Without filtering, every subscriber to a topic gets every message and must discard the irrelevant ones. A filter policy makes SNS deliver only matching messages to each subscription — cleaner and cheaper. The tell is “route only certain messages to certain subscribers from one topic.”
Filter policies: attributes vs message body
SNS subscription filter policies can evaluate message attributes or, when configured for it, the JSON message body. Attribute-based filtering is useful when publishers attach routing metadata such as eventType=order-cancelled. Body-based filtering lets subscribers match fields inside a structured JSON payload without relying on separate message attributes.
Exam traps and operational checks
- Scope: a filter policy is attached to an individual subscription, so different subscribers to the same topic can receive different subsets.
- Publisher metadata: attribute-based filtering only works as intended when the publisher sends the attributes used by the policy.
- Delivery is not filtering: a DLQ handles messages that fail delivery or processing; it does not select messages by business attributes.
- Cost and fan-out: filtering can reduce unnecessary deliveries and downstream processing, but it does not replace access controls or guarantee that a consumer successfully processes a delivered message.
Test yourself
From one SNS topic, only ‘order-cancelled’ events should reach a particular SQS queue, while other events should not. What achieves this without extra code?
- A separate topic per event type
- An SNS subscription filter policy on message attributes
- A Lambda that inspects and forwards
- A dead-letter queue
👉 Click to reveal the answer & explanation
Correct answer: B. A subscription filter policy makes SNS deliver only matching messages to that subscriber — no code. Separate topics per event (A) add management overhead; a forwarding Lambda (C) adds code and cost; a DLQ (D) handles failed deliveries, not filtering.
Related topics
Amazon SNS · Amazon SQS · SQS vs SNS
Build your AWS certification readiness
Stop guessing whether you’re ready. Our full-length, exam-realistic practice exams put you through the exact question style you’ll face — with a detailed explanation behind every answer, so you learn why, not just what.
- ✓ 6 full-length practice exams
- ✓ A detailed explanation for every single question
- ✓ Realistic, scenario-based questions — not memory dumps
- ✓ 6 months of access to your selected certification pack
Explore AWS Practice Exam Packs →or choose a free practice exam