I am trying to use AWS SNS to trigger a Lambda function written in Python 2.7 to deliver a small JSON payload. The Topic and subscription work fine, the Lambda instance is invoked, but the code is not extracting the message, I am using the following code:
import sys,requests,json,pymysql,logging,boto3
def lambda_handler(event, context):
print("Received event: " + json.dumps(event, indent=2))
message = event['Records'][0]['Sns']['Message']
parsed_message = json.loads(message)
print("From SNS: " + parsed_message)
return(parsed_message)
I have tried to call the Python function but I do not know where the arguments should come from when I invoke it. Am I missing another call or piece of code that I will need to include in the Lambda function?