SNS & SQS in AWS

Tharunravuri
2 min readJan 9, 2021

Before deep-diving into SNS and SQS concepts, applications can be built in two types.

Monolithic Application:

The components in any application need to communicate with each other to achieve a result. The components like a web server and database need to communicate with each other to achieve the result.

But, whereas in monolithic applications, all the components in the system are tightly coupled and any failure of the single component fails in a complete application.

Monolithic application architecture

To make an application more reliable, available and efficient the monolithic application infrastructure can be implemented in a micro-services architecture.

Microservices Applications:

As the components in an application needs to communicate with each other. The components in the microservices architecture are implemented independently. This type of architecture is also called loosely coupled systems. Any single component failure in microservices architecture cannot affect the complete application. The remaining components can still communicate with each other.

Microservices architechture

The communication between these components can be made even ease by using AWS services like Simple Notification Service (SNS) and Simple Queue Service (SQS).

Simple Queue Service (SQS):

Components in any application need to communicate with each other to produce a result. But whereas when an application is in the busy state it cannot communicate with the other components. It results in failure of the system.

But SQS(Simple Queue Service) is a service provided by AWS which can store, receives and send messages between software components without losing messages.

Let’s say, component A wants to communicate with component B, but the component B is busy in achieving a task. So it couldn’t respond to component A messages. That’s where the SQS comes into the picture, the SQS service stores all the messages from component A in a queue and after the completion of component B’s work the component B can still retrieve messages from the queue and it can respond to the component A’s messages efficiently.

Simple Notification Service (SNS):

SNS usually uses a publish/subscribe model which is called the pub/sub model in short. By using the SNS model the application can send messages and notifications to the users or the publisher can send messages to its subscribers.

In SNS the publisher creates topics and the subscribers can subscribe to one or multiple topics based on their interests and the subscribers get information from the publisher.

In Amazon SNS, subscribers can be web servers, email addresses, AWS Lambda functions, or several other options.

--

--