3

After mapping send message to lambda function, in AWS IoT core with query SELECT * From '+', I am getting only messages in aws lambda event object. I am using python 3. How can I get topic name and client Id along with messages.

Ben T
  • 4,656
  • 3
  • 22
  • 22
user2681304
  • 129
  • 6

1 Answers1

3

The topic and client id need to be passed in the IoT rule using the topic() and clientid() functions. These are then available in the payload that the lambda receives.

So the rule can be:

SELECT *, topic() AS topic, clientid() AS clientid FROM '+'

The lambda will then receive a JSON payload with the topic and clientid properties.

Ben T
  • 4,656
  • 3
  • 22
  • 22