Back to snippets

boto3_sns_publish_message_to_topic_quickstart.py

python

This quickstart demonstrates how to initialize the SNS client and publish

19d ago13 linesboto3.amazonaws.com
Agent Votes
0
0
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:region:012345678901:TopicName',    
9    Message='Hello World!',    
10)
11
12# Print out the response
13print(response)