Task Statement 3.2: Design high-performing and elastic compute solutions.
📘AWS Certified Solutions Architect – (SAA-C03)
In cloud computing, sometimes different parts of an application need to communicate with each other, but they don’t always need to do it at the exact same time. This is where queuing and messaging services come in—they act as a bridge, letting systems send and receive data reliably, even if they are not running at the same speed.
AWS provides several services for this:
- Amazon SQS (Simple Queue Service) – for queues
- Amazon SNS (Simple Notification Service) – for publish/subscribe messaging
1. Queues: Amazon SQS
Concept:
A queue is like a line where messages wait until they are processed. One system sends messages into the queue, and another system reads and processes them at its own speed.
- Example in IT: A web application generates tasks to process images. Instead of processing them immediately (which could slow down the app), it puts them into a queue. A separate image-processing service takes tasks from the queue when it’s ready.
Key features for the exam:
- Decoupling: Producers (senders) and consumers (receivers) do not need to know about each other.
- Scalability: Multiple consumers can read from the same queue to handle more tasks.
- Reliability: Messages are stored safely until processed.
- Types of Queues:
- Standard Queue – High throughput, at-least-once delivery, messages may arrive out of order.
- FIFO Queue – First-In-First-Out delivery, exactly-once processing, preserves order.
SQS Behavior:
- Messages can have a visibility timeout, meaning they are invisible to other consumers while being processed.
- Dead-letter queues (DLQ) store messages that cannot be processed after multiple attempts.
2. Publish/Subscribe: Amazon SNS
Concept:
Publish/subscribe (pub/sub) is a messaging pattern where one system (the publisher) sends messages, and multiple systems (subscribers) can receive them simultaneously.
- Example in IT: A system publishes a notification when a server is updated. Different services (logging, monitoring, alerting) subscribe and act on that message immediately.
Key features for the exam:
- Multiple subscribers: One message can go to multiple services (SQS queues, Lambda functions, email, HTTP endpoints).
- Decoupling: Publishers and subscribers do not need to know about each other.
- Push-based: Messages are pushed to subscribers as soon as they are published.
SNS + SQS Combination:
- SNS can send a message to an SQS queue. This combines pub/sub with queuing:
- SNS ensures all interested services get the message.
- SQS ensures reliable delivery and allows delayed processing if needed.
3. Differences Between SQS and SNS
| Feature | Amazon SQS | Amazon SNS |
|---|---|---|
| Messaging pattern | Queue (point-to-point) | Publish/Subscribe (one-to-many) |
| Message retention | Up to 14 days | No storage (delivers immediately) |
| Delivery | Consumers poll messages | Push to subscribers |
| Ordering | FIFO available | No ordering guarantee |
| Use case | Process tasks asynchronously | Notify multiple systems at once |
4. Key Exam Points
- Decoupling is the main benefit of using queues or pub/sub systems.
- Scalability: Using SQS/SNS allows applications to scale independently.
- Reliability: Messages are not lost even if consumers are temporarily down.
- Integration with AWS: Both SQS and SNS integrate with services like:
- AWS Lambda (serverless compute)
- Amazon EC2 (virtual servers)
- Amazon S3 (object storage triggers)
- Amazon CloudWatch (monitoring & alerts)
- Choosing the right service:
- Use SQS when tasks must be processed reliably and possibly delayed.
- Use SNS when multiple services need to be notified immediately.
5. Summary for the Exam
- Queues (SQS): Asynchronous, decoupled, reliable, can scale, FIFO for ordered tasks.
- Publish/Subscribe (SNS): Broadcast messages to multiple subscribers, decoupled, push-based.
- Combination: SNS → SQS is common for reliable, scalable notifications to multiple systems.
- Exam Tip: Understand when to use SQS vs SNS, and how they help design high-performing and elastic compute solutions.
