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

Test yourself

Practice question

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?

  1. A separate topic per event type
  2. An SNS subscription filter policy on message attributes
  3. A Lambda that inspects and forwards
  4. 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

CloudExamPro Premium

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