loading words...

Jun 21, 2019 22:19:56

sqs vs. sns

by @swizecteller | 207 words | 🐣 | 113💌

Swizec Teller

Current day streak: 0🐣
Total posts: 113💌
Total words: 31578 (126 pages 📄)

Today I learned about the difference between Amazon SQS – Simple Queue Service, and Amazon SNS – Simple Notification Service.

Both help you send messages between decoupled Lambda Functions 🤨

So why two different things?

---

SQS is a true queueing service. You place messages on a queue and they are processed roughly in sequence. FIFO queues exist but that's extra.

Easiest way to use is to have Lambdas triggered from SQS events.

---

Once your lambda succeeds, that message is deleted and won't be processed again.

SQS keeps retrying until you successfully process a message. You can configure a max number of retries. Once reached, the message is moved to a dead letter queue where it waits for you to debug.

---

SNS on the other hand is ... a queuing service. But instead of a true queue, it's a pubsub system. Messages are published and subscribers receive them.

Each message is published once and if nobody receives it, the message is gone.

---

Wait so if SNS is super lossy and SQS is super reliably ... why would you ever use SNS?

SNS is convenient because the same message can be processed by multiple subscribers.

---

Use SQS when you want reliability.

Use SNS when you want one signal to trigger multiple things.

Originally published at twitter.com

contact: email - twitter / Terms / Privacy