Created
August 14, 2020 14:05
-
-
Save lvthillo/0bfa0b32b4a95df50a166f4b7ab9be56 to your computer and use it in GitHub Desktop.
Python script to publish to SNS topic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import boto3 | |
client = boto3.client('sns') | |
mesg = json.dumps({ | |
"default": "default", | |
"body": "this is a test" | |
}) | |
response = client.publish( | |
TopicArn='arn:aws:sns:eu-west-1:123456789012:Topic', | |
Message=mesg, | |
MessageStructure='json', | |
MessageAttributes={ | |
'color': { | |
'DataType': 'String', | |
'StringValue': 'blue', | |
} | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment