All guides
Practice now
D2 · Resilient architectures

Decoupling: SQS, SNS and EventBridge

Decoupling is key to resilient architectures. SQS adds buffers between components, SNS distributes messages to multiple subscribers, and EventBridge connects services with events. The exam presents scenarios where you must choose the right service.

Icon-Architecture/48/Arch_Amazon-Simple-Queue-Service_48

Amazon SQS — message queues

SQS is a fully managed message queue service. Producers send messages to the queue and consumers process them at their own pace. It fully decouples producer from consumer.

Key SQS parameters

Visibility Timeout

How long a message stays invisible after being read. Default: 30s. If the consumer doesn't delete it, it goes back to the queue.

Message Retention

How long the message lives. Default: 4 days. Max: 14 days.

Long Polling

WaitTimeSeconds=1-20. Reduces empty calls. More efficient than short polling.

Delay Queue

DelaySeconds=0-900. Delays delivery of new messages.

SQS Standard vs FIFO

Standard Queue

•Unlimited throughput

•At-least-once delivery (can duplicate)

•Best-effort ordering (not guaranteed)

•For most use cases

FIFO Queue

•Up to 3,000 msg/s with batching

•Exactly-once delivery (no duplicates)

•Strict order (First-In-First-Out)

•For payments, inventory, auditing

DLQ (Dead Letter Queue)

Messages that fail N times (maxReceiveCount) are moved to a DLQ for analysis. Set up alarms on the DLQ to detect issues.

Icon-Architecture/48/Arch_Amazon-Simple-Notification-Service_48

Amazon SNS — notifications

SNS is a pub/sub notification service. A producer publishes to a topic and all subscribers receive the message simultaneously. Push-based: SNS pushes to subscribers (subscribers don't poll).

SQS Queue

Lambda

Email / Email-JSON

HTTP/S endpoints

SMS / Mobile Push

Amazon Data Firehose

Subscriber types supported by an SNS Topic

Key difference: SNS vs SQS

SNS = Push — SNS sends the message to all subscribers immediately. There's no persistence in SNS.
SQS = Pull — The consumer polls the queue to get messages. Messages persist for up to 14 days.

Icon-Architecture/48/Arch_Amazon-EventBridge_48

Amazon EventBridge

EventBridge is a serverless event bus. It connects applications using events from AWS services, third-party SaaS (Zendesk, Shopify) or your own applications. More powerful than SNS for event-driven architectures.

Event Rules

Filters events by pattern (e.g. "only EC2 instance-state-change events to running") and routes them to targets. Multiple targets per rule.

EC2 terminates → EventBridge → Lambda + SNS + SQS simultaneously

Scheduled Events (Cron)

Runs rules on a defined schedule. Replaces CloudWatch Events for scheduling.

"Run Lambda every Monday at 8am UTC"

Icon-Architecture/48/Arch_Amazon-Simple-Notification-Service_48

Fan-out pattern: SNS + SQS

The Fan-out pattern combines SNS + SQS: a producer publishes to SNS, which distributes the message to multiple SQS queues. Each consumer service has its own queue and processes at its own pace.

Why Fan-out instead of multiple direct queues

Simple producer

The producer publishes to a single SNS topic. It doesn't need to know how many consumers there are.

Buffer per service

Each service has its own independent SQS queue. If one fails, the others keep working.

Scalability

Adding a new consumer = adding an SNS subscription. No changes to the producer.

Icon-Architecture/48/Arch_Amazon-Simple-Queue-Service_48

SQS vs SNS vs EventBridge

ServiceModelPersistenceWhen to use
SQSPull (consumer polls)Up to 14 daysBuffering, decoupling, processing at your own pace, automatic retry
SNSPush (SNS notifies)No persistenceFan-out, alerts, notifications to multiple subscribers
EventBridgeEvent busNo persistence (optional archive)Event-driven, SaaS integration, scheduled tasks, complex routing

Exam trap

If the scenario mentions "messages must not be lost if the service goes down" — you need SQS (it persists). If it mentions "multiple services must receive the same message" — SNS fan-out or EventBridge. Each service processes at its own pace.

Diagram: Fan-out pattern with SNS + SQS

An SNS message distributed to multiple independent SQS queues.

Did you get this topic?

Test what you just learned

An e-commerce application needs to process purchase orders such that: (1) the inventory, billing and notifications services each process every order independently, (2) if one service fails, messages are not lost, (3) each service processes at its own pace. What is the best design?

Ready to test "Decoupling: SQS, SNS and EventBridge"?

Put what you learned to the test with original SAA-C03 exam questions.

Start SAA-C03 mock exam

Unlimited mock exams with the Pro plan

Log in to track your progress.