Need advice about which tool to choose?Ask the StackShare community!

Amazon SNS

+ 1
Amazon SQS

+ 1
Add tool

Amazon SNS vs Amazon SQS: What are the differences?


Amazon Simple Notification Service (SNS) and Amazon Simple Queue Service (SQS) are both messaging services provided by Amazon Web Services (AWS). They are designed to help developers build scalable, decoupled, and fault-tolerant applications.

1. Message Distribution Model:

Amazon SNS uses a publish-subscribe (pub/sub) messaging model, where a single message is delivered to multiple subscribed endpoints. On the other hand, Amazon SQS uses a distributed queuing model, where messages are stored in a queue and processed by consumers at their own pace.

2. Message Retention:

In Amazon SNS, messages are not retained. Once a message is published, it will be delivered to the subscribed endpoints, or discarded if the endpoints are not available. In contrast, Amazon SQS retains messages in a queue until they are explicitly deleted by the consumer.

3. Message Duplication:

Amazon SNS may deliver duplicate messages in certain failure scenarios, but it provides built-in support for deduplication using message attributes. On the other hand, Amazon SQS ensures that each message is delivered at least once and does not deliver duplicates, making it suitable for applications that require strict message ordering.

4. Subscription Protocols:

Amazon SNS supports various subscription protocols such as HTTP/HTTPS, email, SMS, Lambda, and more. It allows flexibility in reaching different types of endpoints. In contrast, Amazon SQS only supports messaging via HTTP/HTTPS.

5. Pricing Model:

Amazon SNS charges based on the number of messages published and the number of API requests made. Amazon SQS charges based on the number of messages transferred in and out of the queue, as well as the number of API requests made.

6. Message Fanout and Delivery Time:

Amazon SNS enables immediate message fanout to multiple subscribers, providing near-real-time message delivery. Amazon SQS, being a queue-based service, offers a delay feature to control the delivery time of messages.

In summary, Amazon SNS uses a pub/sub model, allows various subscription protocols, and incurs charges based on messages published, while Amazon SQS uses a queuing model, supports only HTTP/HTTPS messaging, and charges based on messages transferred.

Advice on Amazon SNS and Amazon SQS
Software Engineer at LightMetrics · | 4 upvotes · 277.2K views
Needs advice
Amazon MQAmazon MQ
Amazon SQSAmazon SQS

I want to schedule a message. Amazon SQS provides a delay of 15 minutes, but I want it in some hours.

Example: Let's say a Message1 is consumed by a consumer A but somehow it failed inside the consumer. I would want to put it in a queue and retry after 4hrs. Can I do this in Amazon MQ? I have seen in some Amazon MQ videos saying scheduling messages can be done. But, I'm not sure how.

See more
Replies (1)
Andres Paredes
Lead Senior Software Engineer at InTouch Technology · | 1 upvotes · 212K views
Amazon SQSAmazon SQS

Mithiridi, I believe you are talking about two different things. 1. If you need to process messages with delays of more 15m or at specific times, it's not a good idea to use queues, independently of tool SQM, Rabbit or Amazon MQ. you should considerer another approach using a scheduled job. 2. For dead queues and policy retries RabbitMQ, for example, doesn't support your use case. I'm not sure if that is possible SNS/SQS support, they have a maximum delay for delivery (maxDelayTarget) in seconds but it's not clear the number. You can check this out:

See more
Get Advice from developers at your company using StackShare Enterprise. Sign up for StackShare Enterprise.
Learn More
Pros of Amazon SNS
Pros of Amazon SQS
  • 12
    Low cost
  • 6
    Supports multi subscribers
  • 62
    Easy to use, reliable
  • 40
    Low cost
  • 28
  • 14
    Doesn't need to maintain it
  • 8
    It is Serverless
  • 4
    Has a max message size (currently 256K)
  • 3
    Triggers Lambda
  • 3
    Easy to configure with Terraform
  • 3
    Delayed delivery upto 15 mins only
  • 3
    Delayed delivery upto 12 hours
  • 1
    JMS compliant
  • 1
    Support for retry and dead letter queue
  • 1

Sign up to add or upvote prosMake informed product decisions

Cons of Amazon SNS
Cons of Amazon SQS
    Be the first to leave a con
    • 2
      Has a max message size (currently 256K)
    • 2
    • 2
      Difficult to configure
    • 1
      Has a maximum 15 minutes of delayed messages only

    Sign up to add or upvote consMake informed product decisions

    What is Amazon SNS?

    Amazon Simple Notification Service makes it simple and cost-effective to push to mobile devices such as iPhone, iPad, Android, Kindle Fire, and internet connected smart devices, as well as pushing to other distributed services. Besides pushing cloud notifications directly to mobile devices, SNS can also deliver notifications by SMS text message or email, to Simple Queue Service (SQS) queues, or to any HTTP endpoint.

    What is Amazon SQS?

    Transmit any volume of data, at any level of throughput, without losing messages or requiring other services to be always available. With SQS, you can offload the administrative burden of operating and scaling a highly available messaging cluster, while paying a low price for only what you use.

    Need advice about which tool to choose?Ask the StackShare community!

    What companies use Amazon SNS?
    What companies use Amazon SQS?
    See which teams inside your own company are using Amazon SNS or Amazon SQS.
    Sign up for StackShare EnterpriseLearn More

    Sign up to get full access to all the companiesMake informed product decisions

    What tools integrate with Amazon SNS?
    What tools integrate with Amazon SQS?

    Sign up to get full access to all the tool integrationsMake informed product decisions

    Blog Posts

    What are some alternatives to Amazon SNS and Amazon SQS?
    Amazon Pinpoint
    Amazon Pinpoint makes it easy to run targeted campaigns to drive user engagement in mobile apps. Amazon Pinpoint helps you understand user behavior, define which users to target, determine which messages to send, schedule the best time to deliver the messages, and then track the results of your campaign.
    Twilio offers developers a powerful API for phone services to make and receive phone calls, and send and receive text messages. Their product allows programmers to more easily integrate various communication methods into their software and programs.
    Amazon MQ
    Amazon MQ is a managed message broker service for Apache ActiveMQ that makes it easy to set up and operate message brokers in the cloud.
    Google Cloud Messaging
    Google Cloud Messaging (GCM) is a free service that enables developers to send messages between servers and client apps. This includes downstream messages from servers to client apps, and upstream messages from client apps to servers.
    Firebase is a cloud service designed to power real-time, collaborative applications. Simply add the Firebase library to your application to gain access to a shared data structure; any changes you make to that data are automatically synchronized with the Firebase cloud and with other clients within milliseconds.
    See all alternatives