Last active
March 7, 2017 21:33
-
-
Save dawn360/78c8344753e2abf6447f45148b86749f to your computer and use it in GitHub Desktop.
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
#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