App Integration Services
SNS, SQS, and Step Functions — decoupling and orchestrating applications
Amazon Simple Notification Service (SNS)
Amazon SNS is a fully managed pub/sub messaging service. It enables you to send messages to a large number of subscribers through a "topic" — a communication channel.
How It Works
- A publisher sends a message to an SNS topic.
- All subscribers to that topic receive the message.
- Subscribers can be email, SMS, mobile push, HTTP/HTTPS endpoints, Amazon SQS queues, AWS Lambda functions, and more.
Common Patterns
| Pattern | Description |
|---|---|
| Fan-out | One message published to an SNS topic is delivered to multiple SQS queues, each processed independently. |
| CloudWatch Alarm to SNS | CloudWatch alarms send notifications to an SNS topic, which delivers them via email, SMS, or triggers automated actions. |
| Lambda Event Source | SNS topics can invoke Lambda functions asynchronously. When a message is published, Lambda runs with the message as input. |
Amazon Simple Queue Service (SQS)
Amazon SQS is a fully managed message queuing service. It enables you to decouple and scale microservices, distributed systems, and serverless applications. SQS eliminates the complexity and overhead of managing and operating message-oriented middleware.
Queue Types
| Type | Characteristics |
|---|---|
| Standard Queue | Nearly unlimited throughput. Best-effort ordering. At-least-once delivery. Messages may arrive in a different order than sent. |
| FIFO Queue | First-In-First-Out delivery. Exactly-once processing. Messages are processed in the exact order they are sent. Limited to 300 messages per second (or 3,000 with high-throughput mode). |
Key Concepts
- Producer: Sends messages to the queue.
- Consumer: Polls the queue for messages and processes them.
- Visibility timeout: After a consumer receives a message, it becomes invisible to other consumers for a configurable period. If not deleted before timeout expires, the message reappears in the queue.
- Dead-letter queue (DLQ): A queue that receives messages that failed processing after a specified number of attempts. Enables investigation of problematic messages.
SNS + SQS Fan-Out
A common pattern: SNS publishes to a topic, and multiple SQS queues subscribe. Each queue can be consumed independently by different services — enabling parallel processing without coupling producers to consumers.
AWS Step Functions
AWS Step Functions is a serverless workflow orchestration service. It lets you coordinate multiple AWS services into flexible, visual workflows. You define state machines using a JSON-based Amazon States Language (ASL).
Key Capabilities
- Sequential steps: Chain Lambda functions or service integrations one after another.
- Parallel execution: Run multiple branches concurrently.
- Branching: Use choice states for conditional logic.
- Error handling: Built-in retry with backoff, catch blocks, and fallback states.
- Human approval: Pause workflows for manual review or sign-off.
Common Use Cases
| Use Case | Services Involved |
|---|---|
| Order processing pipeline | API Gateway → Step Functions → Lambda → SQS → DynamoDB |
| ETL workflow | Step Functions → Lambda → Glue → Redshift |
| Microservice orchestration | Step Functions coordinating multiple Lambda functions with error handling |
SNS vs. SQS vs. Step Functions
| Service | Pattern | Message Model | Key Differentiator |
|---|---|---|---|
| SNS | Pub/sub (push) | Push to all subscribers | One message to many receivers simultaneously |
| SQS | Message queue (poll) | Pull by consumers | Decoupling producer and consumer with durable buffer |
| Step Functions | Workflow orchestration | State machine execution | Coordinate multi-step processes with retry and branching |
App Integration Quiz
Select one answer per question. You will receive immediate feedback.