SQS vs SNS vs EventBridge: Choosing AWS Messaging for Decoupled Apps

Queues, topics and event buses solve different problems. Compare Amazon SQS, SNS and EventBridge on delivery model, ordering, filtering, retries and cost, with patterns like fan-out and DLQs.

Decoupling is one of the best things you can do for a cloud application: when one part slows down or fails, the others keep working. AWS gives you three core messaging services to do it: Amazon SQS (queues), Amazon SNS (pub/sub topics) and Amazon EventBridge (event buses). They overlap, so here is how to tell them apart.

One sentence each

  • SQS: a durable queue. Producers drop messages in; consumers pull them out at their own pace.
  • SNS: a topic. Publishers send a message once; SNS pushes a copy to every subscriber immediately.
  • EventBridge: an event router. Events arrive on a bus; rules match event content and route them to targets, including events from AWS services and SaaS partners.

Comparison

SQSSNSEventBridge
ModelQueue, pullPub/sub, pushEvent bus, rule-based push
Consumers per messageOne (per message)Many subscribersUp to 5 targets per rule, many rules
PersistenceUp to 14 daysNo storage (delivery retries only)No storage by default; archive and replay available
OrderingFIFO queues: strict per message groupFIFO topics with FIFO queuesNo ordering guarantee
FilteringNone (consumer decides)Subscription filter policiesRich content-based patterns
SourcesYour codeYour code, some AWS servicesYour code, 200+ AWS services, SaaS partners, schedules

SQS: buffer work, absorb spikes

Use SQS when work should be done eventually and reliably, even if consumers are slow or down. An order API writes to a queue and returns immediately; workers process orders as fast as they can. Key concepts:

  • Visibility timeout: after a consumer receives a message, it is hidden from others for this period. If the consumer does not delete it in time, it reappears and is processed again. Set it longer than your processing time.
  • At-least-once delivery on standard queues: duplicates can happen, so make consumers idempotent.
  • FIFO queues: ordered, exactly-once processing within a message group, with lower throughput limits.
  • Dead-letter queue (DLQ): after a set number of failed receives, the message moves aside so one poison message does not block everything. Alarm on DLQ depth.
  • Long polling (WaitTimeSeconds up to 20) reduces empty responses and cost.

SNS: notify many at once

Use SNS when one event should trigger several independent reactions immediately: send an email, update analytics and start fulfillment. Subscribers can be SQS queues, Lambda functions, HTTP endpoints, email, SMS and mobile push. Message filtering lets each subscription receive only the messages it cares about, based on message attributes or body.

The fan-out pattern: SNS + SQS

The most common combination: publish to an SNS topic, subscribe one SQS queue per consumer service. Each service gets its own durable copy and processes at its own pace, and adding a new consumer means adding a subscription, not changing the publisher.

EventBridge: route events by content

EventBridge shines when events come from many sources and different consumers care about different subsets:

  • AWS service events: EC2 state changes, S3 object created (when enabled), CodePipeline status, GuardDuty findings.
  • Custom event buses for your domain events (OrderPlaced, PaymentFailed).
  • Rules with patterns like {"detail-type": ["OrderPlaced"], "detail": {"total": [{"numeric": [">", 500]}]}}.
  • Archive and replay to reprocess past events, Pipes to connect sources to targets with filtering and enrichment, and Scheduler for cron-like and one-time schedules.

Compared with SNS, EventBridge has richer filtering and far more sources, but higher per-event latency and cost and lower default throughput. For very high-volume fan-out with simple routing, SNS is often better.

A decision guide

  1. Need to buffer work and let consumers pull at their own pace? SQS.
  2. Need to broadcast one message to many consumers right now? SNS (often fanning out to SQS).
  3. Need to react to AWS service or SaaS events, or route domain events by content? EventBridge.
  4. Need strict ordering? SQS FIFO (with SNS FIFO for fan-out).

Practice it

Build the patterns in real AWS: SQS and SNS: Queue Worker, Topic Fan-Out and a Dead-Letter Queue, EventBridge Custom Bus, Rule and Lambda Target and Order Processing Pipeline: API, SQS Workers, SNS Alerts. Then fix One Bad Payment Blocks the Settlement Queue and Order Audit Events Silently Disappear.

FAQ

Can SQS push to Lambda?

Lambda polls SQS for you through an event source mapping, so from your perspective messages arrive in Lambda automatically.

Which is cheapest?

For high volumes, SQS and SNS are cheaper per message than EventBridge custom events. Model your expected volume; all three have free tiers.

Browse all AWS tutorials · Hands-on AWS labs