amazon-web-servicesaws-iot

how to get AWS IOT rule name


How to get the name of the IOT rule that triggered my lambda function.Am having multiple AWS IOT rules that keep triggering my lambda function.


Solution

  • The only way to do this is to include the rule name in the SELECT part of the SQL statement for the rule.

    You will have to add this manually for each rule, that is to say there is no function for variable that will return this dynamically for you.

    Something like

    SELECT * as data, "my_rule_name" as ruleName, topic() as topic FROM 'myTopic'