Open In App
Related Articles

How To Install AWS CLI – Amazon Simple Notification Service (SNS)?

Like Article
Save Article
Report issue

Amazon Simple Notification Service (SNS) is used for the Application to Application (A2A) and Application to Person (A2P) communication. It provides developers with a highly scalable, flexible, and cost-effective capability to publish messages from an application and immediately deliver them to subscribers or other applications. Using AWS Console it is easy to publish messages to your endpoint of choice (HTTP, SQS, Lambda, mobile push, email, or SMS) and edit topic policies to control publisher and subscriber access.

Advantages of SNS:

  1. Immediate, push-based delivery
  2. Easy for integration
  3. Flexible message delivery using protocols
  4. It supports FIFO topics

Steps to create AWS SNS Service:

The below Steps are related to AWS E-mail SNS Service.

  • Firstly, open the AWS cloud shell and use the following command for creating the topic. Specify the name of the topic, for example, gfg-topic:
$ aws sns create-topic 
--name gfg-topic



  • Subscribe to the Topic:
$ aws sns subscribe --topic-arn arn:aws:sns:us-west
-2:123456789012:gfg-topic --protocol email 
  • Here you can choose your protocol to send your message through which protocol. i.e., HTTP, SQS, Lambda, mobile push, email, or SMS. After running the command you will get the email, to confirm your subscription by clicking on the given link.



  • Publish to a topic: After subscribing to the topic publish your topic and send the message to a perspective person or device.
$ aws sns publish --topic-arn 
gfg-topic --message "Hello Geeks"




  • Unsubscribe the Topic: For stopping receiving messages from the particular application you can unsubscribe using this command:
$ aws sns unsubscribe --subscription-arn


  •  Delete the topic: For deleting the topic you can simply use the below command:
$ aws sns delete-topic --topic-arn



Last Updated : 11 Oct, 2022
Like Article
Save Article
Share your thoughts in the comments
Similar Reads