- I am publishing a String message as message payload using SNS notification from Raspberry Pi using Python program and I want to pass that message payload to a Lambda function.
- I have configured the requirement in the SNS console on AWS i.e., I have created a topic and added the lambda function to its subscribers.
- Now, I want to get that message payload in the lambda function. But I can't find any method that can help me do that. For example, something like getMessage or something similar to that.
- So my questions are: Since I have configured the publishing and subscription on AWS, can I assume that the clients are connected and if I publish a message I should be getting that at the subscriber's end which is my lambda function here? Also, what's the technique in which I can get the message payload in my lambda function? I am adding the below as per cjwfuller's suggestion.
- Below I have written down the method for publishing in Python
client_boto = boto3.client('sns', aws_access_key_id='@@@',
aws_secret_access_key='@@@', region_name='us-west-2')
REGION = 'us-west-2'
TOPIC = 'arn:aws:sns:us-west-2:***:topic_name'
MSG = ntpath.basename(f_string)
SUBJECT_boto = 'File Name'
pub =client_boto.publish(TopicArn = TOPIC, Message = MSG,
Subject=SUBJECT_boto)
I am writing the subscribing code in Java. Since my lambda func is already subscribed to it on AWS console, should my Java program include the subscription again or is there a way to get the msg payload directly.