13.7
SQS vs SNS vs Kinesis, and Amazon MQ
A side-by-side decision guide, and when a standard-protocol broker is the right answer.
18 min Reading + animations
Tip: tap or hover any dotted-underlined term to see what it means.
By the end of this lesson you will be able to
- Compare SQS, SNS and Kinesis Data Streams side by side: push or pull, what happens to a message after it is read, how long data is kept, ordering, duplicates, how many consumers, how each one scales, and replay.
- Pick the right service (or combination) for a scenario from its keywords, including SQS FIFO, SNS + SQS fan-out, Kinesis + Data Firehose, and when the answer is EventBridge or Amazon MSK instead.
- Explain the “core trio” of event-driven AWS, Lambda, SNS and SQS, together with dead-letter queues and the fan-out pattern.
- Explain what Amazon MQ is, which open protocols it speaks (JMS, NMS, AMQP, STOMP, MQTT, OpenWire, WebSocket), and why it is the answer for migrating legacy applications without rewriting them, but not for new cloud-native ones.
- Design Amazon MQ for high availability: ActiveMQ active/standby across two AZs with shared EFS storage, RabbitMQ three-node clusters, and the limits of a broker that runs on servers.
#The chapter on one page
This lesson closes the decoupling chapter. Lesson 13.1 introduced the three models; lessons 13.2 to 13.6 went deep into each service. Here we put them next to each other, so that in an exam question or a design review you can choose in seconds and defend the choice.
A quick reminder of the three models (lesson 13.1):
- Queue (SQS): a producer leaves work; one consumer takes each message, does it, and deletes it.
- Publish/subscribe (SNS): a publisher sends one message; every subscriber gets its own copy, pushed at once.
- Stream (Kinesis Data Streams): producers append records to a log; many consumers read the same records, each at its own position, for as long as the retention period lasts.
The notes put each service in one line:
- Amazon SQS decouples applications. Consumers pull messages from the queue, and a message is deleted for good once a consumer processes it successfully. Use it to give work to a worker tier (video processing, sending email).
- Amazon SNS works on the pub/sub model and pushes data to everyone. A standard topic stores nothing: once sent, the message is finished. Use it when one event must notify many services or users at once (fan-out).
- Amazon Kinesis manages huge volumes of streaming data. Data is not deleted after it is read (there is a retention period), and several consumers can read the same data again and again. Use it for big data and for running different real-time analytics on the same stream.
One order event: into a queue, a topic or a stream
A food-delivery app in Dhaka produces one “order placed” event. Watch what happens to the same event in SQS, in SNS and in Kinesis Data Streams, and what each does when a consumer is away.
Scenario
A queue: consumers pull, one of them processes the message, then deletes it.
The order service sends the event to the queue and moves on. It does not know or care who will process it, or when: that is decoupling.
#SQS vs SNS vs Kinesis side by side
| SQS | SNS | Kinesis Data Streams | |
|---|---|---|---|
| Model | Queue (point to point) | Pub/sub topic | Stream (an ordered log) |
| How data reaches the consumer | Consumers pull (ReceiveMessage, long polling) | SNS pushes to every subscriber | Standard consumers pull (2 MB/s per shard, shared); enhanced fan-out consumers get data pushed (2 MB/s per shard per consumer) |
| After a consumer reads | Hidden for the visibility timeout, then deleted by the consumer | Nothing to read later: each subscriber already got its copy | The record stays until the retention period ends |
| How long data is kept | 4 days by default, 1 minute to 14 days | Standard topics: not persisted (lost if not delivered after the retries) | 24 hours by default, up to 365 days |
| Consumers | As many workers as you like, competing: each message goes to one | Up to 12,500,000 subscriptions per standard topic, each gets a copy | Many consumers, each reads everything; up to 20 enhanced fan-out consumers per stream |
| Ordering | Only FIFO queues (per message group) | Only FIFO topics (per message group) | Per shard (records with the same partition key) |
| Duplicates | Standard: at least once. FIFO: deduplication in a 5-minute window | Standard: at least once. FIFO: deduplication | At least once: consumers must handle duplicates |
| Capacity planning | None: standard queues have nearly unlimited throughput | None: a soft per-Region publish quota | Shards in provisioned mode (1 MB/s or 1,000 records/s in per shard), or on-demand mode that scales for you |
| Replay | No (a DLQ redrive is not replay) | No, except FIFO topics with archiving | Yes, from any point inside the retention period |
| Extra features | Per-message delay up to 15 minutes, DLQs, visibility timeout | Filter policies, many protocols (SQS, Lambda, Firehose, HTTP/S, email, SMS, mobile push) | Consumers such as Lambda, KCL apps, Data Firehose, Managed Service for Apache Flink |
| Message size | Up to 1 MiB (2 GB through S3 with the Extended Client Library) | 256 KiB by default, up to 1 MiB per topic setting | Up to 10 MiB per record |
| Meant for | Worker tiers, buffering, absorbing spikes | Notifications, fan-out | Real-time big data, analytics and ETL |
How to read the table:
- Push or pull decides who has to be ready. With SNS, the subscriber must be reachable when SNS calls; with SQS and standard Kinesis consumers, the consumer asks when it is ready, so a slow or offline consumer only builds a backlog.
- What happens after a read is the deepest difference. A queue is a to-do list: done items are removed. A topic is an announcement: nothing to look up later. A stream is a recording: reading it changes nothing, and anyone can rewind.
- Capacity is a reason to prefer SQS and SNS when you can: there is nothing to size. With Kinesis you choose provisioned shards or on-demand mode (lesson 13.5).
- Ordering costs throughput everywhere: FIFO queues and topics have group-level limits (lesson 13.3), and Kinesis orders only inside one shard.
#Myth: “SNS stores no data”
#Where Data Firehose and Amazon MQ fit
The table above is the classic exam triangle. The other services of this chapter fill two gaps:
| Service | Model | Keeps data? | Replay? | Scaling | Choose it when |
|---|---|---|---|---|---|
| SQS | Queue, pull | Up to 14 days, until deleted | No | Automatic | One worker per message, buffering |
| SNS | Pub/sub, push | No (standard) | No (FIFO archive only) | Automatic | Notify many at once, fan-out |
| Kinesis Data Streams | Stream, pull or push (enhanced fan-out) | 24 h to 365 days | Yes | Shards or on-demand | Many readers, real-time analytics, replay |
| Data Firehose | Delivery pipe, buffers then writes | No (only short retries while a destination is down) | No | Automatic | Load streaming data into S3, Redshift, OpenSearch, Splunk, HTTP endpoints, with no code |
| Amazon MQ | Broker with queues and topics | Yes, until consumed | No | You size the broker | Existing apps that use JMS, AMQP, STOMP, MQTT, OpenWire |
Firehose is covered in lesson 13.6; its exam trick is “near real time, no code, load into a destination”. Amazon MQ gets its own section below.
#Choosing: a decision guide
Is it an existing application that speaks a standard messaging protocol?
If the app uses JMS, NMS, AMQP, STOMP, MQTT or OpenWire with a broker such as ActiveMQ or RabbitMQ, and must move to AWS without rewriting its messaging code: Amazon MQ. Otherwise, continue.
Does each message need to be handled by one worker, or seen by everyone?
One worker per message (jobs, tasks, orders to process): a queue, SQS. If order per customer or exactly-once processing matters: SQS FIFO. If everyone must see every message, continue.
Must every receiver get it now, and is it acceptable that nobody can read it later?
Notifications to people and endpoints (email, SMS, mobile push, HTTP webhooks): SNS. If each receiver is a system that must not lose a message while it is down: SNS + SQS fan-out, one queue per receiver.
Do several consumers need the same data at their own pace, or a replay?
High-volume events (clickstreams, logs, IoT readings, transactions) read by several independent apps, real-time analytics, or reprocessing after a bug: Kinesis Data Streams. If you only need to load the stream into storage without writing code: Data Firehose (directly, or reading from a Kinesis data stream).
Do the events come from AWS services or SaaS apps, routed by rules?
“When an EC2 instance changes state…”, “when someone calls this API…”, events from a partner SaaS, content-based rules to many targets, scheduled events: Amazon EventBridge (chapter 19, lesson 19.5). And if the team already runs Apache Kafka, the managed answer is Amazon Managed Streaming for Apache Kafka (lesson 17.7).
#The keyword map
| The question says… | Answer |
|---|---|
| decouple application tiers, asynchronous processing, worker tier | SQS |
| buffer requests, tolerate traffic spikes, protect the database | SQS |
| scale workers on queue length (backlog per instance) | SQS + Auto Scaling group |
| messages processed in order, exactly once, no duplicates | SQS FIFO (or SNS FIFO + SQS FIFO for fan-out) |
| send notifications to thousands of users or endpoints simultaneously, email/SMS, push notifications | SNS |
| one event triggers multiple independent workflows concurrently without data loss | SNS + multiple SQS queues (fan-out) |
| a subscriber only wants a subset of the messages | SNS filter policy |
| one S3 event must reach several consumers | S3 → SNS → SQS queues (or EventBridge) |
| multiple consumers read the same stream of IoT data at their own pace | Kinesis Data Streams |
| replay data, real-time big data, real-time custom analytics dashboard | Kinesis Data Streams |
| ordering per key (per user, per device) at high volume | Kinesis Data Streams (partition key) |
| archive clickstream to S3, load into Redshift or OpenSearch, no code, near real time, Parquet | Data Firehose |
| migrating existing / legacy applications, standard protocols like JMS / AMQP / MQTT, without rewriting code | Amazon MQ |
| a cloud-native new application | SQS / SNS, not Amazon MQ |
| troubleshoot failed messages, poison pill, prevent infinite processing loops | Dead-letter queue (redrive policy) |
| react to AWS API calls or service events by rules | EventBridge |
Try it with real scenarios before you read the reasons:
Which messaging service fits?
Pick a scenario, make your guess, then read why. Listen for the keywords: one worker or everyone, push or pull, order, replay, no code, legacy protocol.
1. Choose a scenario(Right first time: 0/10)
An online school in Dhaka uploads lecture videos. Each video must be converted to three resolutions by a fleet of EC2 workers. Each job must be done by one worker, and the fleet should grow when work piles up.
2. Your answer
#Combined patterns
Most real systems use more than one of these services. The four patterns below appear again and again, in architectures and in exam answers.
#SNS + SQS fan-out
Publish once to an SNS topic, subscribe one SQS queue per consumer. SNS gives every queue its own copy; each queue then gives its consumer buffering, retries, a DLQ and its own pace. Adding a consumer means adding a queue, with no change to the producer. Each queue’s access policy must allow the topic to send to it; cross-account and cross-Region subscriptions work; a filter policy on a subscription lets that queue receive only some messages; and SNS FIFO + SQS FIFO keeps order through the fan-out. All of this is lesson 13.4.
#S3 events through SNS
An S3 event notification (lesson 10.7) can target SQS, SNS or Lambda, but one event type on one prefix can have only one destination. When an upload must start several independent jobs (thumbnails, virus scan, indexing), the destination is an SNS topic that fans out to several queues. The alternative is sending S3 events to EventBridge, which can route them to many targets.
#Kinesis Data Streams + Data Firehose
A Kinesis data stream takes the high-volume events once. Real-time consumers (Lambda, an app using the KCL, Managed Service for Apache Flink) read it within a second for dashboards and alerts, while Data Firehose reads the same stream and loads it in batches into S3, Redshift or OpenSearch. The stream gives replay and several readers; Firehose gives storage with no code (lesson 13.6).
#SQS in front of a database
During a spike the queue absorbs the burst and the workers (or Lambda) write at a rate the database can take. The producer stays fast, nothing is lost, and the database never sees the wall of traffic (lesson 13.1).
Combined patterns: fan-out, stream plus Firehose, S3 events
Real systems combine the services. SNS copies, SQS buffers, Kinesis keeps a replayable log, Firehose loads it into storage.
Scenario
Publish once; every queue gets its own copy and its own pace.
The order service publishes one “order placed” message to the topic. It does not know how many teams need it.
#The core trio: Lambda, SNS and SQS
The notes call these three the foundation of event-driven architecture on AWS:
- SQS is a message queue that decouples applications. It is pull-based: the consumer (an EC2 worker, or Lambda) takes messages from the queue.
- SNS is pub/sub and push-based: when a message is published, every subscriber (email, SMS, SQS, Lambda…) gets it at once.
- Lambda is serverless compute: it runs your code automatically when an event happens, for example a new message in SQS or a notification from SNS.
One correction that the exam likes: Lambda is not pushed to by SQS. The Lambda service runs an event source mapping that polls the queue (with long polling), hands your function a batch, and deletes the messages when the function succeeds. With SNS it is the other way round: SNS invokes the function. Lambda and event source mappings are covered in depth in chapter 15 (lesson 15.1).
#Dead-letter queues in one paragraph
When SQS, SNS or Lambda fails to process a message again and again (the maximum retries are used up), the message is moved to a separate queue so it is not lost and does not block the rest: the dead-letter queue (DLQ). Developers inspect it later to debug. On SQS you configure it with a redrive policy on the source queue, which names the DLQ and sets maxReceiveCount; when a message has been received that many times without being deleted, SQS moves it. A FIFO queue’s DLQ must also be FIFO, the DLQ must be in the same account and Region, and its retention should be longer than the source queue’s. After the fix you can redrive the messages back to the source. For SNS, a DLQ is an SQS queue attached per subscription. Details and the retention trap are in lesson 13.2.
#The fan-out pattern in one paragraph
One SNS topic, several SQS queues subscribed to it. A message published to the topic fans out to all queues at once, so the same message can drive completely different work in parallel: one queue’s worker saves the order to the database, another’s sends the email. Exam phrase: “a single event needs to trigger multiple independent workflows concurrently without data loss” → SNS + multiple SQS.
The core trio: SQS pulls, SNS pushes, Lambda runs the code
A bKash-style payment service in Dhaka: payment events go to SQS for processing and to SNS for alerts. Watch who pulls, who pushes, and where a poison message ends up.
Scenario
Lambda does not wait to be pushed: the Lambda service polls the queue for you.
The payment API sends each payment to the queue and answers the customer at once. Slow work (ledger, receipt) happens later: asynchronous.
#Amazon MQ
#Why a broker, when SQS and SNS exist
SQS and SNS are cloud-native services with AWS’s own API: you call them over HTTPS with the AWS SDK or CLI. They do not speak the open messaging protocols that the rest of the industry has used for decades.
Many companies still run applications on premises that talk to a message broker such as Apache ActiveMQ, RabbitMQ or IBM MQ through standard protocols and APIs: JMS, NMS, AMQP, STOMP, MQTT, OpenWire, WebSocket. Moving such an application to SQS or SNS means rewriting every send and receive, changing how acknowledgements, transactions, topics and selectors work, and testing it all again.
Amazon MQ is a managed message broker service for Apache ActiveMQ and RabbitMQ. AWS runs the broker for you (provisioning, patching, backups, failover), and it speaks those same protocols, so the application keeps its code and only its connection string changes. That is the whole reason it exists: the notes’ “no time or budget to rewrite for SQS/SNS”.
#The open protocols
| Protocol or API | What it is | Typical clients | Amazon MQ for ActiveMQ endpoint |
|---|---|---|---|
| JMS | The standard Java messaging API (queues, topics, transactions). Not a wire protocol: underneath, the ActiveMQ client usually speaks OpenWire | Enterprise Java apps, Spring, Java EE servers | through OpenWire |
| NMS | The .NET counterpart of JMS | C# and .NET apps | through OpenWire |
| OpenWire | ActiveMQ’s native wire protocol | Java, .NET, C++ ActiveMQ clients | ssl://…:61617 |
| AMQP | Open standard wire protocol for brokers (1.0 on ActiveMQ; 0-9-1 is RabbitMQ’s main protocol) | Any language | amqp+ssl://…:5671 |
| STOMP | A simple text protocol | Python, Ruby, PHP, JavaScript scripts | stomp+ssl://…:61614 |
| MQTT | Lightweight pub/sub protocol for devices | IoT devices, sensors | mqtt+ssl://…:8883 |
| WSS (WebSocket Secure) | WebSocket over TLS, usually carrying STOMP or MQTT | Browsers, web dashboards | wss://…:61619 |
All endpoints use TLS. Amazon MQ for RabbitMQ speaks AMQP 0-9-1 (port 5671), and since November 2025 RabbitMQ 4.2 on Amazon MQ adds native AMQP 1.0; it also offers the RabbitMQ web console. (Side note: RabbitMQ 4.2 runs on the Graviton mq.m7g instances and uses quorum queues as its only replicated queue type; the exam does not go into versions.)
#Two engines
| Amazon MQ for ActiveMQ | Amazon MQ for RabbitMQ | |
|---|---|---|
| Engine | ActiveMQ Classic (5.18 is the default) | RabbitMQ 3.13 or 4.2 |
| Protocols | JMS/OpenWire, NMS, AMQP 1.0, STOMP, MQTT, WebSocket | AMQP 0-9-1, AMQP 1.0 (4.2) |
| High availability | Active/standby pair in two AZs with shared EFS storage; or a network of brokers | Cluster of three nodes in three AZs behind an NLB, each node with its own EBS volume |
| Typical source | Java/JMS estates, mixed-protocol shops, IoT over MQTT | Apps already written for RabbitMQ |
Both engines offer queues (point to point, like SQS) and topics or exchanges (publish/subscribe, like SNS) in one broker. That is how traditional brokers have always worked, and why one Amazon MQ broker can replace both halves of a legacy setup.
A legacy app moves to AWS: Amazon MQ or a rewrite for SQS?
A garments exporter’s Java order system talks JMS to an on-premises ActiveMQ broker. The team moves it to EC2 with no time to rewrite the messaging code.
Scenario
Same protocol, same code: only the broker address changes.
The only change is the connection string: the old broker’s address becomes the Amazon MQ endpoints, written as a failover list.
#It runs on servers
Amazon MQ is managed, but it is not serverless:
- You choose a broker instance type (for example
mq.t3.microfor tests,mq.m5.largeand bigger, or the Gravitonmq.m7gfamily) and a deployment mode. You pay per broker-hour plus storage per GB-month, whether messages flow or not. - A broker has fixed limits: ActiveMQ allows up to 2,000 connections per wire-level protocol on the large instance types (300 on micro), 200 GB of storage on mq.m5 brokers, and 200 brokers per Region by default.
- To handle more load you move to a bigger instance type (applied with a reboot, which on active/standby is a short failover) or build a network of brokers. It does not “scale” the way SQS and SNS do, which the slides point out directly.
- The broker lives in your VPC subnets with security groups. It can be private (reached over VPN or Direct Connect from the office) or publicly accessible. Messages are encrypted at rest with KMS and in transit with TLS; ActiveMQ users authenticate with a username and password or through LDAP.
#High availability
The slides draw the ActiveMQ picture: an active broker in one AZ, a standby broker in another AZ of the same Region, both connected to Amazon EFS as storage, and the client failing over from one to the other.
- Single-instance (ActiveMQ or RabbitMQ): one broker in one AZ, storage on EBS (or EFS for ActiveMQ). Cheap and fine for development; if the AZ or the broker fails, the broker is unavailable until AWS recovers it.
- Active/standby (ActiveMQ): two brokers in two AZs as a redundant pair, sharing one message store on Amazon EFS, which stores data redundantly across AZs. Only one broker is active. When it fails, or during the weekly maintenance window, Amazon MQ promotes the standby, which opens the same store, so persisted messages are not lost; a reboot failover takes only seconds. Each protocol has two endpoints (
-1and-2), and clients must use the failover transport with both, for examplefailover:(ssl://b-…-1.mq…:61617,ssl://b-…-2.mq…:61617). - Cluster (RabbitMQ): three nodes in three AZs behind a Network Load Balancer, sharing users, queues and state; messages are replicated across the nodes. Maintenance is done one node at a time, and clients must reconnect automatically.
- Network of brokers (ActiveMQ): several brokers (each single or active/standby) linked together, for scale or for different sites.
Amazon MQ high availability: active/standby with shared EFS storage
An ActiveMQ broker pair in two Availability Zones. Only one is active; both use the same message store on Amazon EFS. Watch a failure, a maintenance reboot and the single-instance case.
Scenario
One active broker, one standby, one shared store.
The client uses the failover transport with both endpoints (-1 and -2). It connects to whichever broker is active; the standby accepts no connections.
#Amazon MQ vs SQS and SNS
| SQS / SNS | Amazon MQ | |
|---|---|---|
| API and protocols | AWS’s own API over HTTPS (SDK, CLI) | Open standards: JMS, NMS, AMQP, STOMP, MQTT, OpenWire, WebSocket |
| Infrastructure | Serverless, nothing to size | Broker instances you choose, in your VPC |
| Scaling | Automatic, nearly unlimited | Limited by the instance type; scale up or add brokers |
| Availability | Built in across AZs | You choose: single instance, active/standby, or cluster |
| Queues and topics | Separate services (SQS queues, SNS topics) | Both in one broker |
| Cost model | Per request (and per delivery) | Per broker-hour plus storage |
| Features | DLQ, FIFO, filter policies, integrations with Lambda and S3 | Broker features: transactions, message selectors, scheduled delivery, JMS semantics |
| Best for | New, cloud-native applications | Migrating existing applications without rewriting |
#What goes wrong
| Symptom | Likely cause | Fix |
|---|---|---|
| A second team built a consumer on the same SQS queue, and now each team sees only some of the orders | A queue gives each message to one consumer | Fan-out: SNS topic with one queue per team, or a Kinesis stream if they need replay |
| A webhook subscriber missed notifications during a two-hour outage | SNS standard topics do not keep a backlog; retries ran out | Put an SQS queue in front of that subscriber, or at least a subscription DLQ |
| Analytics wants to reprocess last week’s events after a bug, but they came through SQS | Processed SQS messages are deleted; there is no replay | Use Kinesis Data Streams (retention up to 365 days) for data that may need replay, or archive to S3 with Firehose |
Kinesis producers get ProvisionedThroughputExceededException | A shard is over 1 MB/s or 1,000 records/s, often a hot partition key | Better partition keys, more shards, or on-demand mode (lesson 13.5) |
| Two analytics apps on one stream are slow and throttled on reads | Standard consumers share 2 MB/s per shard | Enhanced fan-out gives each consumer its own 2 MB/s per shard |
| A message keeps coming back and blocks a worker for days | Poison message and no redrive policy | DLQ with maxReceiveCount; alarm on the DLQ depth |
| A FIFO workload hits its limit at 300 messages per second | No batching, no high throughput mode, or one message group | Batch up to 10, enable high throughput, spread across message groups |
| A legacy app moved to AWS cannot connect to SQS | SQS has no AMQP/OpenWire/STOMP endpoint | Amazon MQ, or rewrite for the AWS SDK |
| Clients break during every Amazon MQ maintenance window | Clients use one endpoint, not the failover transport | Configure both endpoints with the failover transport, and reconnect logic |
| An Amazon MQ broker slows producers down during a peak | Broker memory or storage is full; flow control kicks in | Bigger instance type, more consumers, shorter queues, or a network of brokers |
| After an Amazon MQ failover some orders were processed twice | Delivered but unacknowledged messages are redelivered | Idempotent consumers (store processed IDs) |
| A single-instance broker went down with its AZ | Single-instance mode has no standby | Active/standby (ActiveMQ) or a cluster (RabbitMQ) for production |
#Messaging in system design
- Default to SQS and SNS for new services: no capacity to plan, pay per use, and the integrations (Lambda, S3 events, ASG scaling, Beanstalk worker environments from lesson 9.4) are built in.
- Queue per consumer, topic per event type. Publish domain events (“order placed”, “payment received”) to SNS topics, and give every consuming service its own SQS queue with its own DLQ. Services can then be deployed, scaled and broken independently.
- Kinesis for data, SQS for work. Events that several teams analyse, or that you may need to replay, belong in a stream; jobs that must be done once belong in a queue. Many systems have both, fed from the same producer.
- Firehose at the end of the stream for the data lake, and Managed Service for Apache Flink or Lambda for real-time results (chapter 17).
- Amazon MQ as a bridge. Lift and shift a legacy app onto Amazon MQ to meet the migration deadline, then build new consumers on SQS/SNS, and retire the broker when the old app goes. AWS migration patterns are in chapter 23 (server migration).
- Idempotency everywhere. Standard SQS, SNS, Kinesis and a broker failover can all deliver a message more than once; consumers should be safe to run twice.
- Watch the backlog.
ApproximateNumberOfMessagesVisiblefor queues,GetRecords.IteratorAgeMillisecondsfor streams, DLQ depth for every queue: these tell you a consumer is falling behind before customers do (CloudWatch, chapter 19). - Events across the account: when the source is AWS itself (an instance state change, an API call recorded by CloudTrail) or a SaaS partner, use EventBridge; lesson 24.1 collects the event-processing architectures.
#Try it yourself
The same “order placed” event through each service. Account 111122223333, Region ap-southeast-1; outputs are shortened.
# 1. SQS: send, receive, delete (one consumer takes it)
aws sqs create-queue --queue-name orders-example
# "QueueUrl": "https://sqs.ap-southeast-1.amazonaws.com/111122223333/orders-example"
Q=https://sqs.ap-southeast-1.amazonaws.com/111122223333/orders-example
aws sqs send-message --queue-url $Q --message-body '{"orderId":"A-1001","area":"Dhanmondi"}'
aws sqs receive-message --queue-url $Q --wait-time-seconds 20 --max-number-of-messages 10
# "Messages": [{ "MessageId": "5fea7756-…", "ReceiptHandle": "AQEB…", "Body": "{\"orderId\":\"A-1001\",…}" }]
aws sqs delete-message --queue-url $Q --receipt-handle "AQEB…"
aws sqs receive-message --queue-url $Q --wait-time-seconds 5 # nothing: it is gone
# 2. SNS: publish once, every subscriber gets a copy (fan-out to the queue above)
aws sns create-topic --name order-events-example
# "TopicArn": "arn:aws:sns:ap-southeast-1:111122223333:order-events-example"
aws sns subscribe --topic-arn arn:aws:sns:ap-southeast-1:111122223333:order-events-example \
--protocol sqs --notification-endpoint arn:aws:sqs:ap-southeast-1:111122223333:orders-example
aws sns subscribe --topic-arn arn:aws:sns:ap-southeast-1:111122223333:order-events-example \
--protocol email --notification-endpoint ops@example.com
aws sns publish --topic-arn arn:aws:sns:ap-southeast-1:111122223333:order-events-example \
--message '{"orderId":"A-1002"}'
# "MessageId": "a1b2c3d4-…" (the queue needs an access policy that allows this topic to send)
# 3. Kinesis: put a record, read it twice, replay from a time
aws kinesis create-stream --stream-name order-stream-example --stream-mode-details StreamMode=ON_DEMAND
aws kinesis put-record --stream-name order-stream-example --partition-key Dhanmondi \
--data '{"orderId":"A-1003"}' --cli-binary-format raw-in-base64-out
# "ShardId": "shardId-000000000002", "SequenceNumber": "49654…"
IT=$(aws kinesis get-shard-iterator --stream-name order-stream-example --shard-id shardId-000000000002 \
--shard-iterator-type AT_TIMESTAMP --timestamp 2026-10-26T09:00:00Z --query ShardIterator --output text)
aws kinesis get-records --shard-iterator $IT # the record is still there, as often as you like
# 4. Amazon MQ: an ActiveMQ active/standby broker in two subnets (two AZs), EFS storage
aws mq create-broker --broker-name orders-mq-example --engine-type ACTIVEMQ --engine-version 5.18 \
--deployment-mode ACTIVE_STANDBY_MULTI_AZ --host-instance-type mq.m5.large --storage-type EFS \
--no-publicly-accessible --auto-minor-version-upgrade \
--subnet-ids subnet-0aaa1111example subnet-0bbb2222example --security-groups sg-0ccc3333example \
--users Username=orders-admin,Password='use-a-long-secret-here',ConsoleAccess=true
# "BrokerId": "b-1234abcd-56ef-78ab-90cd-1234567890ab"
aws mq describe-broker --broker-id b-1234abcd-56ef-78ab-90cd-1234567890ab \
--query 'BrokerInstances[].Endpoints'
# [ ["ssl://b-1234abcd-…-1.mq.ap-southeast-1.amazonaws.com:61617",
# "amqp+ssl://b-1234abcd-…-1.mq.ap-southeast-1.amazonaws.com:5671",
# "stomp+ssl://b-1234abcd-…-1.mq.ap-southeast-1.amazonaws.com:61614",
# "mqtt+ssl://b-1234abcd-…-1.mq.ap-southeast-1.amazonaws.com:8883",
# "wss://b-1234abcd-…-1.mq.ap-southeast-1.amazonaws.com:61619"],
# ["ssl://b-1234abcd-…-2.mq.ap-southeast-1.amazonaws.com:61617", … ] ]
aws mq reboot-broker --broker-id b-1234abcd-56ef-78ab-90cd-1234567890ab # watch the client fail over
# 5. Clean up (the broker costs money every hour, even idle)
aws mq delete-broker --broker-id b-1234abcd-56ef-78ab-90cd-1234567890ab
aws kinesis delete-stream --stream-name order-stream-example
aws sns delete-topic --topic-arn arn:aws:sns:ap-southeast-1:111122223333:order-events-example
aws sqs delete-queue --queue-url $Q
The legacy app only changes its broker URL to the failover form of the two ssl:// endpoints. Notice the contrast in step 4: you chose an instance type, two subnets and a deployment mode, none of which SQS or SNS ever asked you for.
#Summary
Key takeaways
- SQS = queue, pull, one consumer per message, deleted after processing, kept up to 14 days, no capacity planning, order only with FIFO, per-message delay. Worker tiers and buffering.
- SNS = pub/sub, push to up to 12,500,000 subscriptions per topic, standard topics keep nothing (retries, subscription DLQ, FIFO archive and replay are the exceptions), up to 100,000 topics, no capacity planning, FIFO topics for order. Notifications and fan-out.
- Kinesis Data Streams = stream, standard consumers pull (2 MB/s per shard shared), enhanced fan-out pushes (2 MB/s per shard per consumer), records stay 24 hours to 365 days, replay, order per shard, provisioned or on-demand. Real-time big data, analytics, ETL.
- Data Firehose loads streams into S3, Redshift, OpenSearch and more, near real time, no code, no replay. EventBridge routes AWS and SaaS events by rules (lesson 19.5); Amazon MSK is managed Kafka (lesson 17.7).
- Patterns: SNS + SQS fan-out (one event, many independent workflows, no loss), S3 → SNS → SQS, Kinesis + Firehose, SQS in front of a database.
- The core trio: SQS pulls, SNS pushes, Lambda runs code (Lambda polls SQS through an event source mapping). DLQ via a redrive policy for poison messages.
- Amazon MQ = managed ActiveMQ / RabbitMQ broker speaking JMS, NMS, AMQP, STOMP, MQTT, OpenWire, WSS: the answer for migrating existing apps without rewriting, not for new cloud-native apps. It has queues and topics, runs on broker instances and does not scale like SQS/SNS.
- Amazon MQ HA: ActiveMQ active/standby in two AZs with shared EFS storage and the failover transport; RabbitMQ three-node cluster across three AZs; single-instance has no failover.
Answer on your own first, then read the explanation, even when you got it right.
Self-checkQuestion
In which service do consumers pull messages, and is a message deleted once a consumer has processed it?
Self-checkQuestion
An SNS standard topic tries to deliver to an HTTPS subscriber that is down for several hours. No dead-letter queue is configured. What happens to that subscriber’s copy?
Self-checkQuestion
What are the default and maximum retention periods of a Kinesis data stream?
Self-checkQuestion
Which statement about ordering is correct?
Self-checkQuestion
Which two are properties of Kinesis Data Streams?
Choose 2
Self-checkQuestion
Which message broker engines does Amazon MQ manage?
Self-checkQuestion
A company runs an on-premises Java application that exchanges messages with an ActiveMQ broker through JMS. It must move to AWS within two months, and the developers have no time to change the messaging code. Which service should the architect choose?
Self-checkQuestion
A startup is building a new, cloud-native order service on AWS. One engineer suggests Amazon MQ for the job queue because the team knows RabbitMQ. Traffic is unpredictable and the team wants no infrastructure to manage. What should the architect recommend?
Self-checkQuestion
An online school converts uploaded lecture videos into three resolutions on a fleet of EC2 instances. Each video must be processed by exactly one instance, and the fleet should grow when work piles up. Which design fits best?
Self-checkQuestion
A telecom must send an Eid greeting by SMS and app push notification to two million subscribers at the same time. Which service is designed for this?
Self-checkQuestion
When an order is placed, four independent services (kitchen, rider assignment, SMS, analytics) must each process it. Any of them may be down for a while, and no order may be lost. What should the architect use?
Self-checkQuestion
Soil sensors across tea gardens send readings every few seconds. An irrigation controller, a weekly yield model and a research team must each read the same readings at their own pace, and the model sometimes reprocesses old data. Which service fits best?
Self-checkQuestion
A score app wants every clickstream event stored in Amazon S3 as Parquet files, partitioned by date, with no servers and no consumer code. A delay of a minute or two is fine. What should it use?
Self-checkQuestion
A product team needs a custom, real-time analytics dashboard that updates within a second of each event, and another team must later be able to reprocess the same events. What is the best ingestion service?
Self-checkQuestion
A mobile wallet must apply each customer’s transactions in the exact order they happened, and a retried request must never be applied twice. Transactions of different customers may run in parallel. Which option fits?
Self-checkQuestion
Which two statements about Amazon MQ are correct?
Choose 2
Self-checkQuestion
How does Amazon MQ for ActiveMQ provide high availability?
Self-checkQuestion
What does a highly available Amazon MQ for RabbitMQ deployment look like?
Self-checkQuestion
After moving to an Amazon MQ active/standby broker, an app loses its connection during every weekly maintenance window and does not recover until it is restarted. Its connection URL contains only the -1 endpoint. What is the fix?
Self-checkQuestion
After an Amazon MQ failover, a few orders were processed twice. What is the most likely reason?
Self-checkQuestion
A provisioned Kinesis data stream must accept 6 MB/s of writes in 4,000 records per second, and two standard (shared) consumers each read the full stream. What is the minimum number of shards?
Self-checkQuestion
An SNS topic receives 2,000 order messages per minute and has four SQS queues subscribed, with no filter policies. How many messages land in the queues per hour in total?
Self-checkQuestion
An SQS FIFO queue already batches 10 messages per call but tops out around 3,000 messages per second. The workload needs 15,000 messages per second across many customers. What should the team do?
Self-checkQuestion
Which statement about Amazon SNS is NOT true?
Self-checkQuestion
The notes say SNS stores no data. Which two statements are accurate refinements?
Choose 2
Self-checkQuestion
In which two situations is Kinesis Data Streams a better choice than SQS?
Choose 2
Self-checkQuestion
What is the current maximum size of a single Amazon SQS message, without the Extended Client Library?
Self-checkQuestion
Images uploaded under one S3 prefix must start a thumbnail job and a virus scan, each processed independently with retries. The S3 event configuration does not allow two destinations for the same event type on the same prefix. What is the best design?
Self-checkQuestion
A Lambda function processes messages from an SQS queue. How do the messages reach the function?
Self-checkQuestion
A malformed message makes every consumer fail, so it keeps returning to the queue and slows the whole system. What should the architect configure?
Self-checkQuestion
A partner’s webhook, subscribed directly to an SNS standard topic, was down for two hours and lost every notification from that period. The partner must never miss one again. What is the most reliable fix?
Self-checkQuestion
Which two phrases in an exam question point to Amazon MQ?
Choose 2