SQS vs SNS vs EventBridge vs Kinesis: when to use each
How Amazon SQS, SNS, EventBridge and Kinesis Data Streams differ, with a comparison table and the scenario wording that points to each in SAA-C03.
Four services, four shapes of communication
All four move messages or events between parts of an application, which is why exam options so often mix them up. They differ in shape: who receives each message, whether order is kept, and how long messages stay. Get those three right and most scenarios answer themselves.
| Amazon SQS | Amazon SNS | Amazon EventBridge | Kinesis Data Streams | |
|---|---|---|---|---|
| Shape | Queue: producers send, workers pull | Publish/subscribe: each message is pushed to every subscriber | Event bus: rules match events and route them to targets | Stream: an ordered log that consumers read |
| Who gets each message | One consumer at a time; it deletes the message when it's done | Every subscriber gets its own copy | Every target of every rule that matches | Every consumer application, each at its own pace |
| Order | Standard: best effort. FIFO: strict, per message group | Standard: none. FIFO topics: ordered | Not guaranteed on a classic bus | Strict within a shard (by partition key) |
| How long messages stay | 1 minute to 14 days (4 days by default) | Not stored for later reading; delivered as they arrive, with retries | Only in an archive you set up, which you can replay | 24 hours by default, up to 365 days |
| Typical exam wording | decouple, buffer, absorb spikes, workers | fan out, notify, email or SMS | react to AWS or SaaS events, route by content, run on a schedule | real time, clickstream, telemetry, replay, several apps read the same data |
Amazon SQS: a buffer between producers and workers
A queue holds messages until a worker is ready for them. Producers and consumers never call each other, so either side can slow down, scale or restart while messages wait in the queue, for up to the retention period you set. That makes SQS the usual answer when a scenario says a tier is overwhelmed by bursts, or that work must survive a crash. Design for the edge cases too: a message can arrive more than once, a message nobody processes is deleted when its retention period ends, and messages that keep failing belong in a dead-letter queue.
- Standard queues deliver each message at least once, in roughly the order sent, at nearly unlimited throughput. Make processing idempotent, because a message can occasionally arrive twice.
- FIFO queues keep strict order within a message group, so use one group per customer or per order to keep work in parallel. They also reject duplicate sends: a message sent again with the same deduplication ID within the five-minute deduplication interval is accepted only once. A consumer still receives a message again if it doesn't delete it before the visibility timeout ends, so keep processing idempotent here too.
- A consumer hides a message for the visibility timeout while it works on it, then deletes it. If the consumer fails, the message reappears for another worker.
- A dead-letter queue collects messages that keep failing, so one bad message doesn't hold up the rest.
- Messages can be up to 1 MiB. For larger payloads, store the data in Amazon S3 and send a reference, for example with the SQS Extended Client Library.
- Scale workers on the queue: an Auto Scaling policy on the backlog per instance, or Lambda reading the queue.
Amazon SNS: one message, many subscribers
A topic pushes each published message to every subscription: SQS queues, Lambda functions, HTTP or HTTPS endpoints, email, SMS, mobile push and Amazon Data Firehose. Subscribers don't pull, and they don't share messages; each gets its own copy.
- Fan-out: publish once to a topic with several SQS queues subscribed, and each downstream system processes the message independently, at its own pace.
- A subscription filter policy delivers only the messages whose attributes or body match, so subscribers don't have to filter in code.
- FIFO topics keep order and drop repeated publishes of the same message, for fan-out to SQS FIFO queues that need ordering.
- SNS doesn't keep messages for later reading. If a subscriber can be offline, put an SQS queue between it and the topic.
Amazon EventBridge: route events by what's in them
EventBridge receives events, matches them against rules and sends each match to its targets. AWS services publish events to the default event bus automatically, such as an EC2 instance changing state, and many SaaS applications can send events too. That makes it the natural choice when a scenario reacts to something that happened in AWS or in a partner application.
- Rules match on any field in the event, such as its source, its detail type or a value deep in its detail, and can reshape the event before delivery.
- Targets include Lambda, SQS, SNS, Step Functions, Kinesis, API destinations (HTTPS endpoints) and event buses in other accounts.
- An archive keeps events so you can replay them later, for example to recover from an error or to test a new consumer.
- EventBridge Pipes connects one source, such as an SQS queue, a DynamoDB stream or a Kinesis stream, to one target, with optional filtering and enrichment in between.
- EventBridge Scheduler runs one-time or recurring tasks from cron or rate expressions, with no servers to keep running for it.
For new applications, AWS now recommends a newer Custom Event Bus, which keeps events for a period you set and supports ordered delivery and replay. The rules-and-targets bus described here remains available as Custom Event Bus – Classic.
Amazon Kinesis Data Streams: an ordered stream many applications can read
A stream keeps records in shards for its retention period: 24 hours by default, up to 365 days. Records aren't deleted when they're read and each consumer keeps its own position, so several applications can process the same data, and one can re-read it after fixing a bug.
- Records with the same partition key go to the same shard and keep their order. Choose a key with many values, so that traffic spreads across shards.
- In provisioned mode you choose the number of shards; in on-demand mode Kinesis manages capacity for you.
- Enhanced fan-out gives each registered consumer its own read throughput per shard, with lower latency.
- Amazon Data Firehose loads streaming data into Amazon S3, Amazon Redshift, Amazon OpenSearch Service and other destinations without code, and Amazon Managed Service for Apache Flink analyses streams in real time.
How to pick in a scenario
- Does each message need to reach more than one system? If not, and the goal is to buffer work for a pool of workers, choose SQS.
- If it must reach several systems, choose SNS for a simple fan-out (usually into SQS queues). Choose EventBridge when routing depends on the event's content, or when the events come from AWS services or SaaS applications.
- Do several consumers need to read the same high-volume data, in order, in near real time, or replay it later? Choose Kinesis Data Streams.
- Must messages be processed in the order sent, without duplicate sends? Choose an SQS FIFO queue, or an SNS FIFO topic for ordered fan-out, and still make the consumer idempotent.
- Does a person need a notification by email or SMS? Choose SNS.
- Does something need to run on a schedule? Choose EventBridge Scheduler.
Official AWS references
- Amazon SQS message quotas
- Amazon SQS FIFO queues
- Using dead-letter queues in Amazon SQS
- What is Amazon SNS?
- Fanout Amazon SNS notifications to Amazon SQS queues
- Amazon SNS message filtering
- What is Amazon EventBridge?
- Archiving and replaying events in Amazon EventBridge
- Amazon EventBridge Pipes
- What is Amazon EventBridge Scheduler?
- What is Amazon Kinesis Data Streams?
- Kinesis Data Streams: changing the data retention period