This page requires JavaScript to display.
N
Unpacking...
← Cloud Platforms
Cloud Platforms

Amazon SNS & EventBridge

Pub/sub fan-out with filter policies, pipeline alerting, EventBridge rules, Scheduler, Pipes and archives, and a comparison of AWS messaging services.

Contents
1. What Amazon SNS Is 2. Fan-Out with Filtering 3. Pipeline Alerting 4. Amazon EventBridge 5. SNS vs SQS vs EventBridge vs Kinesis 6. Common Interview Questions

1. What Amazon SNS Is

Amazon Simple Notification Service is publish/subscribe messaging: publishers send to a topic, and SNS pushes a copy to every subscription (SQS queues, Lambda functions, HTTP endpoints, email, SMS, Firehose). In data platforms it is used for fan-out and alerts.

Standard topicFIFO topic
Ordering / deduplicationBest effort, possible duplicatesStrict order and deduplication (to SQS FIFO subscribers)
SubscribersAll protocolsSQS queues (and a few others)

2. Fan-Out with Filtering

TOPIC=$(aws sns create-topic --name file-arrivals --query TopicArn --output text)
aws sns subscribe --topic-arn $TOPIC --protocol sqs \
  --notification-endpoint arn:aws:sqs:ap-south-1:111122223333:loader-queue \
  --attributes '{"RawMessageDelivery": "true"}'
aws sns subscribe --topic-arn $TOPIC --protocol sqs \
  --notification-endpoint arn:aws:sqs:ap-south-1:111122223333:audit-queue
{
  "source_system": ["core-banking", "cards"],
  "file_type": [{ "prefix": "txn" }],
  "size_mb": [{ "numeric": [">", 0] }]
}

A subscription filter policy (above, applied to message attributes by default, or to the message body) delivers only matching messages to that subscriber, so each queue receives only what it needs.

import json, boto3

boto3.client("sns").publish(
    TopicArn="arn:aws:sns:ap-south-1:111122223333:file-arrivals",
    Message=json.dumps({"bucket": "acme-lake-prod", "key": "raw/txn/2026-10-26.csv.gz"}),
    MessageAttributes={
        "source_system": {"DataType": "String", "StringValue": "core-banking"},
        "file_type":     {"DataType": "String", "StringValue": "txn_daily"},
        "size_mb":       {"DataType": "Number", "StringValue": "512"},
    },
)

3. Pipeline Alerting

 CloudWatch alarm (Glue job failed, DLQ > 0, Lambda errors)  ─┐
 Step Functions "NotifyFailure" state                         ├──► SNS topic "pipeline-alerts" ──► email / on-call (HTTPS)
 EventBridge rule (Glue Job State Change = FAILED)            ─┘                                └─► chat (Slack/Teams via AWS chat integration)

4. Amazon EventBridge

EventBridge is a serverless event bus: AWS services, SaaS apps and your code publish events, and rules match event patterns and route them to targets (Step Functions, Lambda, SQS, SNS, Kinesis, API destinations and more).

{
  "source": ["aws.glue"],
  "detail-type": ["Glue Job State Change"],
  "detail": {
    "jobName": [{ "prefix": "raw-to-silver" }],
    "state": ["FAILED", "TIMEOUT"]
  }
}
# publish your own business events
import json, boto3
boto3.client("events").put_events(Entries=[{
    "EventBusName": "data-platform",
    "Source": "acme.pipelines",
    "DetailType": "Partition Ready",
    "Detail": json.dumps({"table": "silver.transactions", "dt": "2026-10-26", "rows": 4810233}),
}])
FeatureUse
RulesPattern-match events and route to up to five targets, with input transformation
EventBridge SchedulerCron and rate schedules with time zones and flexible windows, for millions of schedules
PipesPoint-to-point source → filter → enrich → target (e.g. SQS → Step Functions) without code
Archive and replayStore events and replay them later for recovery or testing
Schema registryDiscover and version event schemas

5. SNS vs SQS vs EventBridge vs Kinesis

SNSSQSEventBridgeKinesis Data Streams
ModelPush pub/subPull queueEvent bus with routing rulesOrdered, replayable stream
ConsumersMany subscribers, each gets a copyCompeting consumers share workMany rules and targetsMany independent readers
FilteringSubscription filter policiesNone (consumer side)Rich content-based patternsConsumer side
ReplayNoNo (until deleted)Archive and replayYes, within retention
Best forFan-out, alertsWork queues, bufferingIntegrating services and SaaS eventsHigh-volume streaming analytics

6. Common Interview Questions

QuestionShort answer
How do you fan out one event to several consumers?SNS topic (or an EventBridge rule) delivering to multiple SQS queues, each with its own consumer and DLQ
SNS vs EventBridge?SNS: high-throughput simple pub/sub and notifications. EventBridge: content-based routing across AWS services and SaaS, schedules, archive and replay
What is a filter policy?A JSON rule on a subscription that delivers only messages whose attributes (or body) match
How would you alert on pipeline failures?EventBridge rules on job state changes and CloudWatch alarms publishing to an SNS alerts topic with email, chat or on-call subscriptions