📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials AWS Solutions Architect SQS & SNS — Decoupled Messaging

SQS & SNS — Decoupled Messaging

5 min read Quiz at the end
Master SQS Standard vs FIFO queues, visibility timeout, dead letter queues, and the SNS fan-out pattern for decoupled architectures.

SQS and SNS — Decoupled Messaging

SQS and SNS are messaging services that decouple your application components — producers and consumers can operate independently without being directly connected.

Teacher Note: Think of a restaurant kitchen. The waiter (producer) puts order tickets on a clip (SQS queue). The chef (consumer) picks up tickets at their own pace. If the kitchen gets slammed, tickets stack up safely — the waiter never has to wait for the chef. This is decoupling.

SQS — Simple Queue Service

FeatureStandard QueueFIFO Queue
OrderingBest-effort (may be out of order)STRICT ordering guaranteed
DeliveryAt least once (possible duplicates)Exactly once (no duplicates)
ThroughputUnlimited3,000 messages/second with batching
Best ForHigh-volume, order-independent tasksFinancial transactions, inventory updates

Key SQS Concepts

  • Visibility Timeout: how long a message is invisible after being received — gives consumer time to process (default 30 seconds)
  • Dead Letter Queue (DLQ): receives messages that fail processing N times — for debugging and alerts
  • Long Polling: consumer waits up to 20 seconds for messages — cheaper than short polling
  • Message Retention: 1 minute to 14 days (default 4 days)

SNS — Simple Notification Service

SNS publishes one message to MANY subscribers simultaneously (fan-out pattern). One event can trigger email alerts, SQS queues, Lambda functions, and mobile push notifications at the same time.

ORDER PLACED event --> SNS Topic
    |
    |---> SQS Queue --> Lambda: Update inventory
    |---> SQS Queue --> Lambda: Send confirmation email
    |---> SQS Queue --> Lambda: Update recommendation engine
    |---> Email: Alert business team
    |---> Lambda: Update real-time dashboard
Exam Tip: The SNS + SQS fan-out pattern is one of the most tested SAA-C03 patterns. Publish to ONE SNS topic, fan out to MULTIPLE SQS queues — each queue is processed independently. This ensures: no message loss, independent scaling, and retry on failure. NEVER write to multiple SQS queues directly from the application.
Topic Quiz · 2 questions

Test your understanding before moving on

1. A company processes financial transactions that must be processed in the EXACT order they are received with NO duplicates. Which SQS queue type is required?
💡 SQS FIFO guarantees strict ordering and exactly-once processing — essential for financial transactions where duplicates or out-of-order processing would cause data corruption.
2. An application places an order in one service. The same event must trigger: an inventory update, an email notification, and an analytics update. What is the BEST architecture?
💡 The SNS fan-out pattern publishes once and delivers to multiple SQS queues simultaneously — each queue is processed independently with automatic retry on failure.