Source: unbiased-coder.com

Python AWS Boto3 SNS Guide
Python AWS Boto3 SNS Guide Did you know that SNS supports phone text (sms), email and custom reporting solutions?

As mentioned above here we will be demonstrating how you can programmatically list all SNS topics in AWS using Python.

The code that implements this follows: from boto3_helper import init_aws_session session = init_aws_session() sns = session.client('sns') sns_resource = session.resource('sns') topics = sns.list_topics() topic_arn = topics['Topics']['TopicArn'] topic = sns_resource.Topic(arn=topic_arn) subscriptions = topic.subscriptions.all() for subscription in subscriptions: print('Subscription: ', subscription.arn)

The code for this is shown below: import pprint from boto3_helper import init_aws_session session = init_aws_session() sns = session.client('sns') topic = sns.delete_topic(TopicArn='arn:aws:sns:us-east-1:033533902081:unbiased-coder-sns-topic') pprint.pprint(topic)

Related Articles