AWS Builder Center
SQS, SNS, MSK or Amazon MQ? How to Choose the Right AWS Messaging Service : Part 1

SQS, SNS, MSK or Amazon MQ? How to Choose the Right AWS Messaging Service : Part 1

AWS offers several messaging services, and they overlap enough to be confusing. The choice comes down to three questions: who receives the message, what action it needs to take, and what your application already speaks.

Series: System Design (2 articles)

  1. 2
    SQS, SNS, MSK or Amazon MQ? How to Choose the Right AWS Messaging Service : Part 1 This article

What is messaging and why it matters

When service A calls service B directly, A waits for B and fails when B fails. Keeping a message between them breaks that link. The producer hands off the work and moves on; the receiver processes it for the consumer at its own pace, and a traffic spike becomes a short backlog instead of an outage.
Messaging gives you three things: async processing (the caller does not wait), decoupling (services fail and scale independently), and load smoothing (a buffer protects slow downstream systems like databases).

Amazon SQS: the queue

SQS is a fully managed queue. A producer sends a message, and one consumer picks it up and processes it. Once the consumer deletes it, it is gone.
  • Best for: tasks and jobs, such as order processing, image resizing, payment jobs and email sending
  • Scales with almost no effort, and workers can scale on queue depth
  • Delivery: standard queues are at-least-once with best-effort ordering. FIFO queues add strict ordering and deduplication at lower throughput
  • Failure handling: if a consumer crashes, the message reappears after the visibility timeout. Messages that keep failing move to a dead-letter queue (DLQ)
Because delivery is at-least-once, consumers must be idempotent, meaning that processing the same message twice gives the same result.

Amazon SNS: pub/sub

SNS is publish/subscribe. A publisher sends one message to a topic, and every subscriber gets its own copy. Subscribers can be SQS queues, Lambda functions, HTTP endpoints, email or SMS.
  • Best for: one event with many independent reactions
  • Example: an "order placed" event that inventory, billing, email and analytics all need
The publisher does not know who is listening, so you can add a new subscriber without touching the producer.

The classic pattern: SNS to SQS fan-out

SNS pushes a message and moves on, so a down subscriber can miss it. SQS holds a message until someone processes it. Put them together: publish once to SNS, and give each consumer its own SQS queue.
You get broadcast from SNS plus durable, retryable, independently scaled processing from SQS. A slow email service backs up its own queue and never blocks billing.

Amazon MSK: managed Kafka

MSK runs Apache Kafka for you. Kafka is not a queue. It is a replayable, append-only log split into partitions.
  • Messages stay for the retention period, so consumers can re-read them
  • Many consumer groups read the same data independently
  • Ordering is guaranteed per partition
  • Built for very high throughput and event streaming
Best for: event streaming, analytics pipelines, event sourcing, and teams that already use Kafka or need its ecosystem. The trade-off is more to design and operate than SQS: partitions, consumer groups and capacity planning. (Kinesis Data Streams is the AWS-native alternative with a similar log model.)

Streaming: a different mental model

Queues and pub/sub treat a message as something to deliver and forget. A queue removes it once processed, and SNS pushes a copy and moves on. Streaming treats events as a durable, ordered record. Events stay in the log, and each consumer keeps its own bookmark (called an offset) showing how far it has read.
That one difference explains everything else. Because the data stays, a consumer can rewind and replay it. A new service can read the full history, and a bug fix can reprocess last week's events. Neither is possible with a standard queue.

How MSK works

  • Topics and partitions: events are written to a topic, which is split into partitions. Each partition is an ordered log, and ordering is guaranteed within a partition.
  • Keys: events with the same key (for example, an order ID) always land in the same partition, so everything about one order stays in order.
  • Replication: each partition is copied across brokers in multiple Availability Zones, so losing a broker does not lose data.
  • Consumer groups: each group reads the whole topic independently. Inside a group, partitions are shared among the consumers, so the number of partitions caps your parallelism.
  • Offsets and replay: a consumer commits its position and can rewind to an earlier offset to reprocess events.
  • Retention: data is kept for a time or size limit you choose, and reading it does not delete it.
  • Delivery: at-least-once by default. Exactly-once is possible with idempotent producers and transactions, but consumers should still be written to handle duplicates.
What AWS manages: brokers, patching, replication and multi-AZ setup. What you still manage: topic and partition design, consumer lag, capacity and scaling. MSK Serverless reduces the capacity work, and MSK Connect runs Kafka connectors for moving data in and out. Kinesis Data Streams offers a similar log model that is AWS-native and simpler to operate.

MSK vs SQS vs SNS


Feature
SQS
SNS
MSK (Kafka)
Mental model
Work queue
Broadcast
Durable event log
After delivery
Deleted
Pushed to all subscribers
Retained
Replay
No
No
Yes, rewind by offset
Consumers
Compete for messages
One copy per subscriber
Each consumer group reads all events
Ordering
Best effort (FIFO option)
Best effort (FIFO option)
Guaranteed per partition
Who tracks progress
The service (visibility timeout)
Nobody (push and done)
The consumer (offset)
Scaling unit
Automatic
Automatic
Partitions and brokers
Effort
Lowest
Lowest
Highest
Same order example, three views: with SQS, an order is a work item that one worker completes. With SNS, it is an announcement that every interested service hears. With MSK, it is an entry in a ledger that any service can read now, or reread from the beginning.
Choose a stream when you need replay, several independent readers, per-key ordering, very high throughput, event sourcing or real-time analytics. Stay with SQS or SNS when you simply need jobs processed or events broadcast, because they are far less to design and operate.

Amazon MQ: managed ActiveMQ and RabbitMQ

Amazon MQ is a managed broker for Apache ActiveMQ and RabbitMQ. Its reason to exist is compatibility: it speaks standard protocols such as JMS, AMQP, MQTT and STOMP.
Best for: lift-and-shift migrations of existing applications that already depend on a traditional broker, where rewriting the messaging code is not worth it. For new cloud-native systems, SQS and SNS are usually simpler and cheaper.

Side by side


Feature
SQS
SNS
MSK
Amazon MQ
Model
Queue
Pub/sub
Replayable log
Traditional broker
Receivers
One consumer
Many subscribers
Many consumer groups
Queues and topics
After delivery
Deleted
Delivered to all
Retained, replayable
Depends on config
Ordering
FIFO option
FIFO option
Per partition
Broker-dependent
Effort
Lowest
Lowest
Highest
Medium
Pick it for
Jobs and tasks
Event fan-out
Streaming and replay
Migrating legacy apps

How to choose

  1. A task one worker should handle? SQS.
  1. One event, many reactions? SNS to SQS.
  1. High volume, ordering, replay or many independent readers? MSK (or Kinesis).
  1. An existing app that speaks JMS, AMQP or MQTT? Amazon MQ.
  1. Unsure? Start with SQS and SNS. They are the simplest, and you can add a stream when replay or throughput demands it.
A useful first question is whether the caller needs the answer immediately. If yes, a synchronous call is the right tool. If no, messaging is probably the right one.

Trade-offs to remember

Messaging adds complexity. You trade immediate consistency for eventual consistency, so you need clear status feedback for users. You need idempotent consumers, dead-letter queues and monitoring on queue depth and message age. The patterns are simple, but the discipline around them is what makes a system reliable.

Takeaway

SQS is for work, SNS is for news, MSK is for history, and Amazon MQ is for compatibility. Pick based on who needs the message and what your application already speaks, and start simple.

Series: System Design (2 articles)

  1. 2
    SQS, SNS, MSK or Amazon MQ? How to Choose the Right AWS Messaging Service : Part 1 This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article