How to delete SNS Topic using AWS CLI



If you want to delete an AWS SNS Topic via AWS CLI - Command Line Interface, you can make use of the below steps.


Step 1: Get the List of all SNS Topics

% aws sns list-topics

-----------------------------------------------------
|                    ListTopics                     |
+---------------------------------------------------+
||                     Topics                      ||
|+-------------------------------------------------+|
||                    TopicArn                     ||
|+-------------------------------------------------+|
||  arn:aws:sns:us-east-1:5xx2xx665xx1:emailTopic  ||
||  arn:aws:sns:us-east-1:5xx2xx665xx1:smsTopic    ||
|+-------------------------------------------------+|

Step 2: Unsubscribe Subscriptions if Any

% aws sns unsubscribe --subscription-arn arn:aws:sns:us-east-1:5xx2xx665xx1:smsTopic:e25591a4-xx-xx-xx-xx

Step 3: Delete SNS Topic

% aws sns delete-topic --topic-arn arn:aws:sns:us-east-1:5xx2xx665xx1:smsTopic
Example - Delete AWS SNS Topic via CLI Command
-

Facing issues? Have Questions? Post them here! I am happy to answer!


Author: Rakesh
Author Info:

Rakesh is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

Copyright © Code2care 2023 | Privacy Policy | About Us | Contact Us | Sitemap