DEV Community


Posted on

What’s the difference between SNS vs SQS?

This topic is exciting to discuss. Why? because what u see doesn’t mean what’s right.

They may seem similar but that doesn’t mean the same. like twins hahaha.

One day my coworker asked me about the difference between them?…. of my insufficient knowledge. I answer with my personal opinion. I said “ I think they are the same, one is not had a queue and another one had it. just it.”

After I answer it. makes me ask myself again. it’s the true answer? That makes my curiosity burning.

So, what is the real difference between them? without my assumption. I google it and learn it that’s my conclusion. HERE WE GO…

SNS … -. …

SNS will always push the message to the consumer. About this, I can analogy with the youtube subscribe feature I think.

If u guys subscribe to ur guy's beloved YouTubers. Every time they had the new content of it. u will get the notification right?

So SNS like that. every single subscriber subs to one Youtuber(Publisher) when they post the content(Publisher Push Topic) to their channels(Topic). The server(SNS) will push the notification to all of the subscribers. And the SNS will push the message as soon as possible when they receive it. that’s why you guys will get the notification as soon as possible too when the Youtuber publishes some new content.

SNS usually use to broadcast messages. Food ordering app, when the food is ready to be delivered, u guys will be getting a notification about the food on the way, in delivery man will be getting a notification for taking the food and delivering the food.

SQS … — .- …

Right, on the SQS also about the queue too. but not only that. SQS requires the client to pull.

I will give u guy’s another analogy about the SQS. What I can say is first come first serve, like us in a restaurant. because there are other customers who come first to the restaurant and doing the order(message), automatically the waiter will serve this customer first. In another word, other waiters don’t need to serve this customer again with the same order(message) right? because the first waiter already served it.

For the SQS, if the SQS had some message on the queue, which consumer getting the first message will be serving it and another consumer will be can’t get the first message again but they will get the second one. That’s why the SQS consumer needs to pull every time. Like we are in a restaurant, we already know what we should order(message), and we will raise our hand(the message already to serve) so the waiter will come to us and ask about the order(message) after u guy’s order something(waiters pull the message from customer) and after getting the order(message) the waiter will bring the order to the kitchen(executions).

SQS usually use when we want to do the decoupling of our applications or services.

SNS will always wrestle with Topics and Broadcasts. But on SQS will always with queuing and FIFO.


Push message to the consumer.
Topic and Broadcast.
One message to all subscribers.

Consumers pull the message.
Queuing and FIFO
Many consumers pull the message queuing.


This is a personal note about SNS and SQS for me and I think this will be great if I share it with you guys. So correct me if I am wrong. hahaha, just a new programmer without any great skills. needs advice and input.

Thank youuuuu……

Top comments (0)