How to delete AWS SNS Subscription using CLI

If you want to delete an AWS SNS Topic using the AWS CLI you can make use of the aws sns unsubscribe command.

Let's take a look at an example.


Syntax:

aws sns unsubscribe --subscription-arn <subscription-arn> 

Example:

% aws sns unsubscribe --subscription-arn 
      arn:aws:sns:us-east-1:5xx211xx5xx1:smsTopic:e25591a4-a7xx-45xx-acxx-7b1xx37bcxx8
Example - Delete AWS SNS Subscription using CLI

If you want to get a list of all the subscriptions for a given SNS topic, you can make use of the below command.

aws sns list-subscriptions-by-topic --topic-arn <topic-arn>

Comments & Discussion

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