DevOps Articles

Curated articles, resources, tips and trends from the DevOps World.

Python AWS Boto3 SNS Guide

2 years ago unbiased-coder.com
Python AWS Boto3 SNS Guide

Summary: This is a summary of an article originally published by the source. Read the full original article here →

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)

Made with pure grit © 2024 Jetpack Labs Inc. All rights reserved. www.jetpacklabs.com