SQS vs SNS

Queue-based point-to-point messaging versus topic-based fan-out delivery.

Overview

What is being compared

SQS and SNS are both AWS messaging services, but they solve different problems and are often used together.

  • Model — Distributed message queue — Pub/sub notifications
  • Who gets a message — A single consumer — Every subscriber, at the same time
  • Fits — Work queues, buffering between services, retry and dead-letter patterns — Broadcasting events to many systems; email, SMS, HTTP, Lambda and SQS targets
  • Used together — As the per-consumer queue in fan-out — As the distributor in fan-out

A message's life in an SQS queue

SNS keeps nothing once it has pushed a message; an SQS message has a life of its own until a consumer deletes it. That difference is what makes SQS the buffer in fan-out.

> [!TIP] The fan-out architecture, one job's trip through a queue and the choice between SQS, SNS and both, step by step in Visual Explanation below.

Sign up free to read the full topic

More Comparisons topics

Start free on Cariara · Coding problems · System design studio