Skip to content

Instantly share code, notes, and snippets.

@dawn360
Last active March 7, 2017 21:33
Show Gist options
  • Save dawn360/78c8344753e2abf6447f45148b86749f to your computer and use it in GitHub Desktop.
Save dawn360/78c8344753e2abf6447f45148b86749f to your computer and use it in GitHub Desktop.
#Publish
import json
import boto3
message = {"foo": "bar"}
client = boto3.client('sns')
response = client.publish(
TargetArn=arn,
Message=json.dumps({'default': json.dumps(message)}),
MessageStructure='json'
)
# recieve
def lambda_handler(event, context):
#print("Received event: " + json.dumps(event, indent=2))
message = event['Records'][0]['Sns']['Message']
print("From SNS: " + message)
return message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment