SQS vs SNS vs EventBridge: How to Choose the Right Messaging Service
Compare AWS SQS, SNS, and EventBridge differences. Learn selection criteria for message queue, Pub/Sub, and event bus patterns for SAA-C03 exam.
Related Exam Domains
- Domain 2: Design Resilient Architectures
Key Takeaway
Use SQS for 1:1 message queuing (decoupling), SNS for 1:N Pub/Sub (fan-out), and EventBridge for event-based routing (rule-based filtering + SaaS integration). Combining them is common (e.g., SNS → SQS fan-out).
Exam Tip
Exam Essential: "Decoupling, async processing = SQS", "1:N broadcast = SNS", "Event-driven + SaaS integration = EventBridge", "SNS + SQS = fan-out pattern"
3 Messaging Patterns
1. Message Queue (SQS):
[Producer] → [Queue] → [Consumer]
→ 1:1, consumer pulls messages (Pull)
2. Pub/Sub (SNS):
[Publisher] → [Topic] → [Subscriber 1]
→ [Subscriber 2]
→ [Subscriber 3]
→ 1:N, topic pushes messages (Push)
3. Event Bus (EventBridge):
[Event Source] → [Event Bus] → Rule 1 → [Target A]
→ Rule 2 → [Target B]
→ Rule-based routing, content filtering
Amazon SQS
Key Features
| Item | Description |
|---|---|
| Pattern | Message Queue (Point-to-Point) |
| Delivery | Pull (consumer retrieves messages) |
| Message Retention | Up to 14 days (default 4 days) |
| Message Size | Up to 256KB |
| Ordering | Standard: ❌, FIFO: ✅ |
| Deduplication | Standard: ❌, FIFO: ✅ |
| Throughput | Standard: Unlimited, FIFO: 3,000/sec (batched) |
Standard vs FIFO
Standard Queue:
[Message A, B, C] → Order NOT guaranteed ❌, At-least-once delivery
→ Unlimited throughput
→ Suitable for most use cases
FIFO Queue:
[Message A, B, C] → Order guaranteed ✅, Exactly-once delivery
→ 300/sec (3,000/sec with batching)
→ Order processing, financial transactions
→ Queue name must end with .fifo
DLQ (Dead-Letter Queue)
[SQS Main Queue]
│
├── Processing Success → Message deleted
│
└── Processing Failure (maxReceiveCount exceeded)
│
▼
[DLQ] ← Failed messages isolated
→ Analyze/reprocess later
Exam Tip
SQS DLQ: Isolates messages that repeatedly fail processing. The maxReceiveCount setting determines how many failures before sending to DLQ.
Visibility Timeout
Consumer A retrieves message
→ Message invisible to other consumers (default 30 seconds)
→ Complete processing + delete within 30 seconds → Success
→ Exceeds 30 seconds → Becomes visible again → Another consumer can process
Amazon SNS
Key Features
| Item | Description |
|---|---|
| Pattern | Pub/Sub (Publish/Subscribe) |
| Delivery | Push (pushes to subscribers) |
| Subscriber Count | Up to 12,500,000 per topic |
| Message Size | Up to 256KB |
| Message Retention | ❌ (lost on delivery failure) |
| Filtering | Subscription filter policies |
Subscription Protocols
| Protocol | Description |
|---|---|
| SQS | Deliver to SQS queue |
| Lambda | Invoke Lambda function |
| HTTP/S | POST to HTTP endpoint |
| Send email | |
| SMS | Send text message |
| Kinesis Data Firehose | Deliver to stream |
SNS + SQS Fan-out Pattern
Order Completed Event:
[Order Service] → [SNS Topic: OrderComplete]
│
├── [SQS: Payment Queue] → [Payment Service]
├── [SQS: Inventory Queue] → [Inventory Service]
├── [SQS: Notification Queue] → [Notification Service]
└── [Lambda: Analytics Recording]
→ Each service processes independently
→ One failure doesn't affect other services
Exam Tip
SNS + SQS Fan-out: When exam scenarios mention "one event needs to be processed independently by multiple services," this pattern is the answer.
Message Filtering
SNS Topic: Order Events
Subscription 1 (Payment Service):
Filter: {"order_type": ["premium"]}
→ Receives only premium orders
Subscription 2 (General Processing):
Filter: None
→ Receives all orders
Amazon EventBridge
Key Features
| Item | Description |
|---|---|
| Pattern | Event Bus |
| Event Sources | AWS services, SaaS, custom apps |
| Targets | 18+ AWS services |
| Filtering | Event patterns (content-based) |
| Schema | Schema registry + code generation |
| Archiving | ✅ Event archiving and replay |
Event Rules
EventBridge Rule Examples:
Rule 1: EC2 State Change
Event Pattern: {"source": ["aws.ec2"], "detail-type": ["EC2 Instance State-change"]}
Target: SNS → Admin notification
Rule 2: S3 Object Created
Event Pattern: {"source": ["aws.s3"], "detail": {"bucket": {"name": ["my-bucket"]}}}
Target: Lambda → File processing
Rule 3: Schedule
Schedule: cron(0 9 * * ? *)
Target: Lambda → Daily 9 AM report generation
EventBridge Differentiators
Features EventBridge has that SNS doesn't:
1. SaaS Integration (Zendesk, Shopify, Datadog, etc.)
2. Schema Registry (auto-discover event structure)
3. Event Archiving & Replay
4. Schedule-based triggers (cron)
5. API Destinations (external API calls)
6. Global Endpoints (cross-region)
3 Services Comparison
| Item | SQS | SNS | EventBridge |
|---|---|---|---|
| Pattern | Queue (1:1) | Pub/Sub (1:N) | Event Bus |
| Delivery | Pull | Push | Push |
| Message Retention | Up to 14 days | ❌ | Archiving available |
| Filtering | ❌ | Subscription filters | Event patterns (powerful) |
| Ordering | FIFO only | FIFO topics | ❌ |
| SaaS Integration | ❌ | ❌ | ✅ |
| Scheduling | ❌ | ❌ | ✅ (cron/rate) |
| Target Count | 1 | 12.5M subscribers | 5 targets/rule |
| Cost | Per request | Publish + delivery | $1/million events |
Selection Guide
Messaging Service Selection:
│
▼
1:1 Async Processing + Decoupling?
│
Yes → [SQS]
│ ├── Need ordering? → FIFO
│ └── No ordering needed? → Standard
No
│
▼
1:N Message Broadcast?
│
Yes → [SNS]
│ └── Fan-out to multiple SQS? → SNS + SQS
No
│
▼
Event-driven Architecture / SaaS Integration / Scheduling?
│
Yes → [EventBridge]
│
No
│
▼
Real-time Streaming Data?
│
Yes → [Kinesis]
Combination Patterns
SNS + SQS (Most Common)
[Producer] → [SNS] → [SQS 1] → [Consumer 1]
→ [SQS 2] → [Consumer 2]
→ Fan-out + independent processing + message retention
EventBridge + SQS
[AWS Service Events] → [EventBridge] → Rule → [SQS] → [Lambda]
→ Event filtering + reliable processing
SAA-C03 Exam Focus Points
- ✅ Decoupling: "Component separation + async = SQS"
- ✅ Fan-out: "1:N broadcast = SNS, SNS + SQS combination"
- ✅ FIFO: "Order guarantee + deduplication = SQS FIFO"
- ✅ DLQ: "Isolate failed messages = Dead-Letter Queue"
- ✅ EventBridge: "SaaS integration, scheduling, event-driven = EventBridge"
Exam Tip
Sample Exam Question: "In an order system, when an order is completed, payment, inventory, and notification services must each process independently. One service failure should not affect other services." → Answer: SNS topic + SQS queue per service (fan-out pattern)
Frequently Asked Questions
Q: Should I use SQS and SNS together?
For fan-out scenarios, combine SNS + SQS. When SNS delivers messages to multiple SQS queues, each consumer processes independently, and failed messages stay in the queue for retry.
Q: Can EventBridge replace SNS?
In many cases yes, but SNS has unique features like SMS/email delivery and massive subscriber support. Use EventBridge for AWS service event-based routing, SNS for A2P notifications.
Q: Can SQS messages be delivered more than once?
Standard Queue uses at-least-once delivery, so duplicates are possible. Use FIFO Queue for exactly-once delivery, or implement idempotency in consumers.
Q: How should I set SQS visibility timeout?
Set it longer than the message processing time. If too short, messages being processed become visible to other consumers. Default is 30 seconds, maximum is 12 hours.
Q: What should I consider when integrating Lambda with SQS?
Lambda uses SQS as an event source to automatically poll messages. Configure batch size, concurrency, and error handling (DLQ settings) appropriately. FIFO queues process only one Lambda per message group ID.
Related Posts
- S3 Event Notifications: Lambda, SQS, SNS Integration
- Lambda Function Optimization
- Auto Scaling Group Setup and Policies