Blog > AWS Simple Notification Service (SNS) Vs. Simple Queue Service (SQS)
SNS stands for simple notification while SQS stands for simple queue service. SNS uses a publisher-subscriber system; for example, an owner owns a topic to publish, and subscribers get notified of events delivered to that topic. However, AWS Simple Queue Service (SQS) is a fully managed message queuing service.
AWS Simple Notification Service
SNS is a web service that coordinates handling the delivery or sending the messages to subscribing endpoints or clients. It is a fully managed and flexible service that eliminates a lot of overhead and complexity in managing mass public publication/subscriber distribution.
There are some couple of things that need to do to set up SNS are as follows:
- Creating an SNS Topic.
- Set up subscriptions for your SNS Topic.
- User subscriptions can receive messages either as an email or receive it as an HTTP or in the form of an application that can be a Lambda function or any SQL processing.
In Amazon SMS, there are two types of clients, such as publishers, and subscribers also referred to as producers and consumers. The publishers communicate asynchronously with subscribers by producing and sending a message to a topic, which is a logical access point and communication channel. Subscribers like web servers share by using email addresses, Amazon SQS, and Amazon lambda functions or receive the message or notification over one of the supported protocols, including Amazon SQS, HTTP, or HTTPS, email, SMS, and lambda when they subscribed to the topic.
In this diagram, we can see in the center here is an SNS topic publisher pushing a message to the SMS topic, which is then publishing it to one or multiple subscribers, including lambda, SQS, HTTP, email, and SMS. When using SNS, you as, the owner, create a topic, and control access to it by defining policies that determine which publishers and subscribers can communicate with a topic. A publisher sends messages to topics they have created, or they have permission to publish it; instead of including a specific destination addressing each message, a publisher sends a message to the topic.
Amazon SNS matches the specific topic to a list of subscribers who have subscribed to that topic and delivers the message to each subscriber. Each topic has a unique name that identifies the Amazon SNS endpoints for the publisher to post messages and subscribers to register for notifications. Subscribers receive all messages published to the topics they subscribe to, and all subscribers to a topic receive the same messages.
AWS Simple Queue Service
It is a distributed system and serverless application. SQS makes it simple and cost-effective to decouple and coordinate the components of a cloud application. Using SQS, you can send, store, and receive messages between software components at any volume and without losing messages and requiring other services to be always available.
Configuration of SQS with the following tasks:
- Create the queue
- Send the message
- Pool the queue
- View the message
- Delete the message
AWS Simple Notification Service (SNS)
- Service to set up, operate, and send notifications to subscribers of topics via multiple HTTP, Email, SQS, and SMS protocols.
- SNS is generally used for sending plain text emails, which is triggered via other AWS Services. The best example of this is billing alarms.
- Users can retry sending in case of failure for HTTPS.
- Follows the publish-subscribe (pub-sub) messaging paradigm
- Publisher establishes a connection with subscribers asynchronously by sending a message to a topic.
- The topic contains a list of subscribers and methods to communicate with the theme.
- Method containing subscribers’ cloud be SQS, HTTP(s), email, SMS, etc.
- Suitable for webhooks, simple internal emails, triggering Lambda functions
AWS Simple Queue Service (SQS)
- Message Queuing Service which places messages in a queue it can retain a message for 14 days. Applications pull queue using AWS SDK.
- It can send them in sequential order or parallel and ensure that messages are delivered at least once.
- Fast, reliable, scalable, and fully managed by Amazon.
- It is useful to DECOUPLE the component of a Cloud Application.
- Can Transmit any volume of data to other services.
- Ensure delivery of messages at least once.
- Multiple readers and writers are possible for interacting with the same queue.
- It is suitable for delayed tasks, queuing up emails
Author: SVCIT Editorial
Copyright Silicon Valley Cloud IT, LLC.