MESSAGING & EVENT-DRIVEN ARCHITECTURE / SYSTEM CONCEPT BRIEF

SNS

Amazon SNS (Simple Notification Service) is a managed pub/sub service.

BeginnerPhase 06 / Topic 6 of 18RequirementsTrade-offsFailure modes
01

Overview

Amazon SNS (Simple Notification Service) is a managed pub/sub service. Publishers send messages to a topic, and SNS pushes a copy to every subscriber: SQS queues, Lambda functions, HTTP endpoints, email, SMS, or mobile push. Subscription filter policies let each subscriber receive only the messages it cares about.

The most common architecture is SNS-to-SQS fan-out: one topic per event type, with each consuming service owning an SQS queue subscribed to it. SNS provides the broadcast, and SQS provides durable buffering, retries, and dead-letter queues per consumer.

A PA system

An announcement is made once over loudspeakers, and everyone in each room hears it. SNS is the PA system; SQS queues are rooms with answering machines that record the announcement for people who are away.

02

When to use it

  • Fan-out of events to multiple AWS services.
  • Sending notifications via SMS, email, or mobile push.
  • Alerting from CloudWatch alarms.
  • Simple event broadcasting without running brokers.
03

Where it shows up in interviews

Fan-out

Recognize it when: one event, several consumers on AWS.

  • Design order processing on AWS
  • Design an upload pipeline with multiple processors
User notifications

Recognize it when: send SMS or push at scale.

  • Design a notification service
  • Design OTP delivery
04

Where it is used in real software

CloudWatch alarms

Alarms publish to SNS topics that page on-call engineers or trigger automation.

Mobile push

SNS sends push notifications via APNs and FCM.

S3 event notifications

S3 can publish object-created events to SNS for fan-out to multiple processors.

05

Key terms

Topic
Named channel for publishing.
Subscription
Endpoint that receives messages from a topic.
Filter policy
Attribute rules deciding which messages a subscriber gets.
FIFO topic
Ordered, deduplicated delivery to FIFO SQS queues.
Delivery retry policy
Retries for HTTP and other push endpoints.
06

How it works, step by step

  1. 1
    Create a topic

    For example order-events.

  2. 2
    Subscribe endpoints

    SQS queues per service, Lambda, HTTP.

  3. 3
    Add filter policies

    Only OrderShipped to the email service.

  4. 4
    Publish with attributes

    type = OrderShipped.

  5. 5
    SNS pushes copies

    Retries failed deliveries; DLQs capture undeliverable messages.

07

SNS vs SQS vs EventBridge

AWS messaging services

Step 1 / 4
ServiceModelDeliveryBest for
SNSPub/sub pushFan-out to manyBroadcast, notifications
SQSQueue pullOne consumer per messageBuffering, work distribution
EventBridgeEvent bus with rulesRule-based routingEvent-driven integrations, SaaS events
KinesisStreamOrdered shards, replayHigh-volume streaming analytics

NOWService: SNS | Model: Pub/sub push | Delivery: Fan-out to many | Best for: Broadcast, notifications

SNS + SQS is the classic fan-out combination; EventBridge adds content-based routing and schema discovery.

08

Implementation

{  "type": ["OrderShipped", "OrderDelivered"],  "country": ["US", "CA"],  "totalCents": [{ "numeric": [">=", 10000] }]}
09

Complexity and performance

Fan-outMillions of subscribers per topic

Managed by AWS.

Message size256 KB

Same as SQS.

10

Trade-offs

Push vs durability

SNS alone does not retain messages for offline consumers; pair with SQS for durability.

Simplicity vs routing power

Filter policies cover common cases; EventBridge offers richer routing and archives.

11

Variants and related techniques

FIFO topics

Ordered fan-out to FIFO queues.

Message archiving and replay

Available for FIFO topics.

12

Common mistakes

  • Subscribing Lambdas directly without DLQs.

    Fix: Configure DLQs or use SQS in between.

  • Putting routing logic in every consumer.

    Fix: Use filter policies so consumers receive only what they need.

13

Interview questions

Why use SNS with SQS instead of SNS alone?

SNS pushes messages immediately and does not buffer for slow or offline consumers. SQS queues give each consumer durable storage, independent pacing, retries, and DLQs.

How would you send order-shipped notifications by email and push?

Publish OrderShipped to an SNS topic; subscribe an email-worker queue and a push-worker queue with filter policies; each worker formats and sends through its provider.

14

Practice problems

ProblemDifficultyWhat it trains
Design SNS + SQS fan-out for an upload pipelineEasyFan-out.
Design an alerting pipeline with SNSMediumRouting and escalation.