Why decouple?
Tightly coupled systems fail together: a spike or crash in one service cascades to others. Loose coupling absorbs spikes, isolates failures, and lets teams deploy independently — core SAA resilient design theme.
Messaging patterns
| Pattern | Service | Model |
|---|---|---|
| Queue | SQS | Pull; one consumer per message (standard) or FIFO ordering |
| Pub/sub fan-out | SNS | Push to many subscribers (Lambda, SQS, HTTP, email) |
| Event bus | EventBridge | Schema-based routing from AWS services and custom apps |
| Stream | Kinesis | Real-time ordered records; multiple consumers read same stream |
Amazon SQS essentials
- Standard queue — at-least-once delivery, best-effort ordering, nearly unlimited throughput.
- FIFO queue — exactly-once processing, strict order, throughput limits (batching + high throughput mode on exam as option).
- Visibility timeout — message hidden while worker processes; extend if job takes longer or message returns to queue.
- Dead-letter queue (DLQ) — after
maxReceiveCountfailures, message moves to DLQ for inspection (poison pill pattern). - Long polling — reduces empty receives and cost (
WaitTimeSeconds).
Exam pattern: sudden traffic burst → queue between API and workers → Auto Scaling on worker fleet based on queue depth (CloudWatch ApproximateNumberOfMessagesVisible).
Amazon SNS
- Topics publish to multiple subscribers in parallel.
- Common combo: SNS → SQS fan-out (each subscriber queue gets a copy) for durable parallel processing.
- Message filtering — subscribers receive subset based on JSON attributes.
- FIFO topics exist for strict ordering use cases.
Amazon EventBridge
- Event bus — default bus for AWS service events; custom buses for multi-account/org patterns.
- Rules match event patterns → target (Lambda, Step Functions, SQS, SNS, API destinations).
- Schema registry — discover and enforce event shapes.
- Archive & replay — debug and reprocess events.
Prefer EventBridge over SNS when routing many event types from AWS services with content-based filtering.
Idempotency and ordering
- Design consumers idempotent — duplicate deliveries happen (SQS standard, SNS retries).
- Need strict order per customer? FIFO SQS or Kinesis partition key — not standard SQS.
Step Functions (bonus tie-in)
Orchestrate multi-step workflows with built-in retries, catch, and parallel branches — exam mentions when coordinating Lambda + human approval + compensating transactions.
Reference architecture
API Gateway → Lambda → SQS → EC2/ECS workers (Auto Scaling on queue depth)
↘ DLQ → alarm → ops
S3 upload event → EventBridge rule → Lambda thumbnail + SNS notify
Exam traps
- SQS is pull — consumers poll; SNS is push.
- DLQ must be same type (FIFO → FIFO) and configured on source queue.
- "Exactly-once" in exam usually means FIFO SQS + idempotent consumer, not standard queue.
Official reference
SAA-C03 exam guide — scalable and loosely coupled architectures.