SNS is something kind of simple notification service which is given by Amazon. You have many other notifications always out there even Google provides a notification service. But today we are going to discuss this Amazon simple notification service. On one note if I want to say, in SNS there is something called push notification. For many of your products whether it can be mobile apps or websites, we need notification to our user which is very important.
In our day-to-day life, we use a lot of apps like Whatsapp or Facebook. On Facebook, if a friend likes a photo you used to get a notification. Also if some message comes to WhatsApp you used to get a notification. So we have many apps. When you are using these apps frequently because they are sending notifications to us. If something happened in our account they are sending a notification. This makes us always use that particular app so that is the key trick developers are making to use their products.
So Amazon SNS is one such service where you can push notifications to your users. You can send notifications for One user or multiple users and also you can send various push notifications such as SMS notifications, e-mail notifications, and many other notifications. Also, you can send notifications to endpoint devices like Android, iOS, and even Apple devices, Google drive, fire OS, Windows devices. As you can send notifications to many devices and you can use any programming language to build this SNS with your platform that is with your products which is highly scalable means it supports more users and more devices as an endpoint and it is more flexible towards messaging service.
This push notification supports a mobile device, email and SMS, and other HTTP protocol services also possible. Even an endpoint can be an application to this kind of Amazon SNS. This Amazon SNS is a part of FreeType which you can use it. If you exceed the FreeType then you have to pay but for one year it is a free subscription.
How SNS works?
SNS is a pushed-based service. First, you can go to service and you should be able to find SNS and application integration. So click on it and you should land upon a starting page. Then click on get start and there are a couple of options there. You can create a topic or an application platform or a subscription or you can publish a message.
SNS basically has a topic. You create a topic then you have multiple subscribers. That subscribe to it and then when a publisher publishes some data to a particular topic. All the subscribers that have subscribed to this topic will receive a notification with that particular data.
For example in the stock market, you might be subscribing to multiple stocks or lets you have particular stock. Multiple clients subscribe to a particular stock. When the market price of stock changes, all the people who are subscribed to stock will get a notification with the current price. This is how SNS works.
So you have a topic you publishes a data or a message to a topic and all the subscriber that subscribed to that topic will receive that message.
STEP 1: So let’s create a topic as we know SNS is a region-specific service so make sure you select the correct region it doesn’t matter what region you select but the latency of your message when you publish a message or when you receive will depend on this particular region.
STEP 2: Let me give some name test topics and create. Once your topic is created you can publish or you can basically create a subscriber to it. So let’s create a subscription to this topic.
STEP 3: This ARN is already pre-populated. So it can be STD P ord STD PSN point. It can be an email or an email JSON format or you can even send your message from a topic to an Amazon SQS queue.
You basically want to go to multiple SQS queue the way you do it is when the message arrives in SQS is basic forwarded to an SNS topic and have multiple other SQS queues subscribing to this topic and that’s how one SQS queue can broadcast the message to multiple SQS queue using a topic. So in Amazon SQS, you can create a new application. It means you can use something like Google GCM notification to send notifications to your android device .and stuff like that so that’s like what an application is for and finally you can even trigger a lambda-based SNS notification that you receive.
SNS is a push-based delivery, i.e., messages are pushed to multiple subscribers. In this, Messages are pushed to multiple receivers at the same time.