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

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!