Skip to content

Instantly share code, notes, and snippets.

@lvthillo
Created August 14, 2020 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lvthillo/0bfa0b32b4a95df50a166f4b7ab9be56 to your computer and use it in GitHub Desktop.
Save lvthillo/0bfa0b32b4a95df50a166f4b7ab9be56 to your computer and use it in GitHub Desktop.
Python script to publish to SNS topic
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