Introduction to AWS Boto in Python
Maksim Pecherskiy
Data Engineer!
sns = boto3.client('sns',
region_name='us-east-1',
aws_access_key_id=AWS_KEY_ID,
aws_secret_access_key=AWS_SECRET)
response = sns.create_topic(Name='city_alerts')
topic_arn = response['TopicArn']
Or... a shortcut
sns.create_topic(Name='city_alerts')['TopicArn']
response = sns.list_topics()
sns.delete_topic(TopicArn='arn:aws:sns:us-east-1:320333787981:city_alerts')
Create SNS Client
sns = boto3.client('sns',
region_name='us-east-1',
aws_access_key_id=AWS_KEY_ID,
aws_secret_access_key=AWS_SECRET)
Create a topic
response = sns.create_topic(Name='city_alerts')
topic_arn = response['TopicArn']
List Topics
response = sns.list_topics()
topics = response['Topics']
Delete a topic
sns.delete_topic(TopicArn='arn:aws:sns:us-east-1:320333787981:city_alerts')
Introduction to AWS Boto in Python