Arkinu
AWS service comparison

Amazon SNS vs Amazon SQS: differences and when to use each

Amazon SNS
Amazon SQS

Often confused on the examQuestions tend to offer one as a distractor for the other: look for the phrase in the scenario that tips the balance.

Application Integration

Amazon SNS

Managed publish/subscribe service: publishers send messages to a topic, and Amazon SNS delivers them to all of its subscribers, such as Amazon SQS queues, AWS Lambda functions, HTTP(S) endpoints, email, or SMS. It handles distributing the same message to many destinations (fan-out) and sending notifications.

Exam phrases that point here

  • «send the same message to multiple systems at once (fan-out)»

    An SNS topic delivers a copy of every published message to all of its subscribers, so the producer publishes once and does not need to know each destination.

    When not: If the consumers must process at their own pace or may be down, SNS alone is not enough: combine it with one Amazon SQS queue per consumer. If the distribution depends on rules over the content of events from many sources (including SaaS), Amazon EventBridge is usually a better fit.

  • «publish/subscribe (pub/sub) model with push delivery»

    SNS pushes the message to subscribers as soon as it is published; nobody has to periodically check whether there are new messages.

    When not: If the scenario requires a single consumer to pull messages when it can (polling) and the messages to wait until they are processed, that is a queue: Amazon SQS. If you want routing rules based on an event pattern, look at Amazon EventBridge.

  • «notify administrators by email or SMS»

    A topic supports email and SMS subscriptions, and it is the usual target for operational alerts, for example when an alarm fires.

    When not: SNS sends notifications, not templated email campaigns or mailbox management; for marketing or transactional email at scale, the scenario points to another service. Also, the alarm itself is detected by Amazon CloudWatch: SNS only delivers it.

  • «each subscriber must receive only the messages it cares about»

    SNS lets you assign a filter policy to each subscription, so the subscriber receives only the messages whose attributes or body meet the conditions.

    When not: If filtering is the heart of the problem, with many rules over events from AWS services or SaaS applications and many types of targets, Amazon EventBridge may be the best option. If there is only one consumer, a topic is not needed.

  • «broadcast messages in order and without duplicates to multiple subscribers»

    SNS FIFO topics deliver messages in order and exactly once, and can feed the SQS FIFO queues of several systems.

    When not: With a single consumer, an SQS FIFO queue is enough. If the data will be analyzed as a continuous stream, Amazon Kinesis Data Streams is usually a better fit. A standard topic guarantees neither ordering nor the absence of duplicates. And if the distribution is decided with per-subscriber filters, the new Custom Event Bus in Amazon EventBridge also delivers in order per event group and deduplicates on publish.

  • «send push notifications to mobile applications»

    SNS Mobile Push delivers notifications to apps on mobile devices through push services such as APNs or FCM; they arrive as alerts, badges, or sounds.

    When not: If the scenario is about syncing app data or authenticating mobile users, push notification is not the core requirement and the answer will be another service.

Often paired with

  • Amazon SQS
  • AWS Lambda
Study Amazon SNS →

Application Integration

Amazon SQS

Managed message queue that stores messages until a consumer processes and deletes them, or until their retention period expires (14 days maximum). It is used to decouple the components of a distributed system and to absorb load spikes as a request buffer.

Exam phrases that point here

  • «decouple the application components»

    A queue sits between whoever produces the work and whoever processes it: the producer leaves the message and moves on, and the consumer picks it up when it can. If either one fails or slows down, the other does not notice.

    When not: If the same message must reach several targets at once, the pattern is publish/subscribe (Amazon SNS), and if you need to route events based on their content or react to events from AWS or third-party services, Amazon EventBridge is usually a better fit.

  • «absorb traffic spikes without losing requests»

    The queue stores the messages while the consumers cannot keep up, so the spike turns into a processing delay instead of lost requests.

    When not: It only works if the work can be done asynchronously. If the user needs the response right away, the solution is to scale the tier that responds (for example, with a load balancer and Auto Scaling), not to queue.

  • «process messages in the exact order they were sent and without duplicates»

    Amazon SQS FIFO queues preserve ordering within each message group and prevent processing the same message twice.

    When not: A standard queue guarantees neither ordering nor the absence of duplicates. And if several consumers must read the same data stream or reprocess it in real time, think of Amazon Kinesis Data Streams, not a queue.

  • «isolate messages that could not be processed so they can be analyzed later»

    A dead-letter queue receives the messages that consumers failed to process after several attempts, so they do not block the queue and can be reviewed.

    When not: If the scenario asks to retry or capture failures of an asynchronously invoked AWS Lambda function, or of an AWS Step Functions workflow, the answer may lie in that service's configuration and not in an SQS queue.

  • «each task must be processed by a single worker»

    In a queue, a received message is hidden from the other consumers for the duration of the visibility timeout; the worker that processes it deletes it when done.

    When not: If several systems must be notified of the task at once, each with its own copy, the clue points to Amazon SNS (often combined with several SQS queues).

Often paired with

  • AWS Lambda
  • Amazon SNS
Study Amazon SQS →