Skip to content
Mar 8

AWS SQS vs SNS vs Kinesis Messaging Comparison for Exams

MT
Mindli Team

AI-Generated Content

AWS SQS vs SNS vs Kinesis Messaging Comparison for Exams

For AWS certification exams and real-world architecture, choosing the correct messaging or streaming service is a frequent and critical decision. Scenario-based questions will test your ability to analyze requirements for ordering, throughput, and consumer patterns to select between Amazon SQS, Amazon SNS, and Amazon Kinesis Data Streams. Mastering their distinct purposes—decoupling, fan-out, and real-time streaming—will help you dissect exam problems and design robust cloud systems.

Core Concept 1: Amazon SQS – The Decoupling Queue

Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications. Its primary role is to provide a reliable, highly-available buffer between message producers and consumers, allowing them to operate independently and at different speeds.

SQS offers two queue types with distinct guarantees. The SQS Standard Queue provides maximum throughput, best-effort ordering, and at-least-once delivery. This means messages are generally delivered in the order they are sent, but occasional out-of-order delivery is possible. It offers nearly unlimited transactions per second. In contrast, the SQS FIFO Queue guarantees first-in, first-out delivery, exactly-once processing, and limited throughput of up to 3,000 messages per second per API action (with batching). FIFO queues are essential for operations where order and duplication are critical, such as processing banking transactions.

A key characteristic is the consumer model: SQS uses a pull-based, competing consumers model. Multiple worker instances can poll a single queue, but each message is delivered to and processed by only one consumer before being deleted. Messages are retained for a configurable period, defaulting to 4 days and extending to a maximum of 14 days. This retention policy allows consumer applications to fail and restart without immediately losing messages.

Core Concept 2: Amazon SNS – The Fan-Out Pub/Sub Service

Amazon Simple Notification Service (SNS) is a fully managed publish/subscribe messaging service. Its core function is to facilitate the fan-out pattern, where a single message from a publisher is replicated and pushed to multiple endpoints simultaneously. Think of it as a broadcast system, not a storage queue.

The central entity in SNS is a topic. Publishers send messages to a topic, and the SNS service immediately pushes these messages to all subscribed endpoints. These endpoints can be diverse, including SQS queues, HTTP/S webhooks, AWS Lambda functions, email, and SMS. This makes SNS ideal for creating event-driven architectures where an event, like a new user registration, must trigger multiple, independent downstream processes (e.g., send welcome email, update analytics, process profile picture).

SNS provides high throughput, at-least-once delivery, and no message ordering guarantees by default. For scenarios requiring ordered, deduplicated fan-out, you can use SNS FIFO topics, which integrate only with SQS FIFO queues. A critical exam point is that SNS does not retain messages. If no endpoint is subscribed, or if an HTTP endpoint is unavailable, the message is lost unless you configure a dead-letter queue for retries. Its consumer model is push-based; SNS actively delivers messages to subscribers, unlike SQS where consumers must poll.

Core Concept 3: Amazon Kinesis Data Streams – The Real-Time Streaming Platform

Amazon Kinesis Data Streams is designed for real-time ingestion and processing of streaming data at massive scale. It is not a simple message queue but a durable, ordered real-time data stream. Use it when you need to collect, process, and analyze data continuously, with the ability for multiple applications to consume the same data simultaneously from a point in time.

Data is organized into shards, which are the base throughput units of a Kinesis stream. Each shard provides a capacity of 1MB/sec data input and 2MB/sec data output, and can support up to 5 read transactions per second using the Enhanced Fan-Out feature. Producers (like servers, IoT devices) put records into the stream. The key differentiator is the consumer model: Kinesis supports multiple consumer types reading from the same stream concurrently. For example, one application can perform real-time analytics using the Kinesis Client Library (KCL) while another archives the data to S3 using Kinesis Data Firehose.

Message retention in Kinesis is configurable from 1 to 365 days, making it a durable log of events. This allows consumer applications to fail and replay data from a previous point, which is crucial for reprocessing or for new analytics applications to be deployed on historical data. Ordering is guaranteed per shard and exactly-once within a partition key. Throughput is scaled by adding or removing shards.

Decision Framework: Choosing the Right Service

Exam questions often present a detailed scenario. Your task is to match the requirements to the service's strengths. Use this framework:

  1. Do you need simple, asynchronous decoupling between a producer and a single consumer group? Choose SQS. It’s the workhorse for offloading tasks, buffering requests, and separating components. Ask: Is it a one-to-one, pull-based, process-and-delete workflow?
  2. Do you need to fan out one event to multiple, independent downstream systems simultaneously? Choose SNS. It’s the tool for one-to-many, push-based notifications. A classic pattern is SNS -> Multiple SQS Queues, which provides durability, fan-out, and decoupled processing.
  3. Do you need to ingest and process continuous, high-volume data streams in real time, with multiple applications reading the same data? Choose Kinesis Data Streams. It’s for real-time analytics, complex event processing, and building data lakes from live data. Key triggers are terms like "real-time dashboard," "clickstream analysis," "telemetry from thousands of devices," or "replay data."
CharacteristicSQS StandardSQS FIFOSNSKinesis Data Streams
Primary PatternDecoupling (1:1)Ordered Decoupling (1:1)Pub/Sub Fan-Out (1:Many)Real-Time Streaming (1:Many)
OrderingBest-effortStrict, FIFONone (or FIFO with FIFO topic)Strict per shard
DeliveryAt-least-onceExactly-onceAt-least-onceAt-least-once per shard
ThroughputNearly unlimitedUp to 3,000 msg/sec (with batching)Very highScales with shards (1MB/sec/shard)
RetentionUp to 14 daysUp to 14 daysNo retention1 to 365 days
Consumer ModelPull, Competing ConsumersPull, Competing ConsumersPush to SubscribersMultiple Consumers (Pull/Push)

Common Pitfalls

Exam questions are designed to test your applied knowledge, not just definitions. Watch for these patterns and common traps:

  • Trap: Using SNS for guaranteed delivery to a single endpoint. If a scenario describes a single, critical processing step, SNS is wrong because it doesn't retain messages. The correct pattern is the producer sending directly to an SQS queue.
  • Trap: Using SQS for true real-time analytics. While you can process messages from SQS quickly, it is not designed for millisecond-latency analytics, replayable logs, or multiple concurrent consumer applications on the same data stream. That is the domain of Kinesis.
  • Trap: Using Kinesis for simple task decoupling. Kinesis is overkill (and more expensive) for a basic application that just needs to offload a task to a worker. SQS is the simpler, more cost-effective choice.
  • Key Pattern: "Order matters, no duplicates." This immediately points to SQS FIFO. If the scenario adds "and notify several systems," you likely need an SNS FIFO topic fanning out to multiple SQS FIFO queues.
  • Key Pattern: "Multiple teams need the same data." This often indicates Kinesis. For example, "The marketing team needs clickstreams for a real-time dashboard, and the data science team needs to store them for weekly model training." Both can consume from the same Kinesis stream independently.

Summary

  • SQS is your go-to for decoupling components via a pull-based queue. Choose Standard for high throughput; choose FIFO when you need exactly-once processing and strict ordering.
  • SNS enables the fan-out (pub/sub) pattern, instantly pushing messages to multiple subscribers (like SQS queues, Lambda, HTTP). It does not store messages.
  • Kinesis Data Streams is built for real-time streaming data analytics, with long-term retention (1-365 days) and support for multiple consumer applications to read the same data concurrently from a durable log.
  • For exams, identify the core need: Is it simple decoupling (SQS), broadcasting an event (SNS), or continuous data processing (Kinesis)? Combine them (e.g., SNS->SQS) for powerful, event-driven architectures.

Write better notes with AI

Mindli helps you capture, organize, and master any subject with AI-powered summaries and flashcards.