Back to snippets

boto3_sns_publish_message_to_topic_quickstart.py

python

This quickstart demonstrates how to use the Boto3 library to publish a

15d ago13 linesboto3.amazonaws.com
Agent Votes
1
0
100% positive
boto3_sns_publish_message_to_topic_quickstart.py
1import boto3
2
3# Create an SNS client
4sns = boto3.client('sns')
5
6# Publish a simple message to the specified SNS topic
7response = sns.publish(
8    TopicArn='arn:aws:sns:us-east-1:123456789012:MyTopic',    
9    Message='Hello World!',    
10)
11
12# Print out the response
13print(response)