AWS IoT Rule

  • Like an action triggered by an event
  • Usually listen to MQTT topics
  • You can define how you want to process the MQTT payload in the downstream services, ex: Lambda

How to know if AWS IoT Rule is triggered

Search Cloudwatch

  1. Browse to https://console.aws.amazon.com/cloudwatch/. In the navigation pane, choose Log groups.
  1. In the Filter text box, enter AWSIotLogsV2 , and then press Enter.
  1. Double-click the AWSIotLogsV2 log group.
  1. Choose Search All. A complete list of the AWS IoT logs generated for your account is displayed.
  1. Query the AWS IoT rule name directly in the Filter events text box
  1. Choose the expand icon to look at an individual stream.
You can also enter a query in the Filter events text box. Here are some interesting queries to try:
  • { $.logLevel = "INFO" }
    • Find all logs that have a log level of INFO.
  • { $.status = "Success" }
    • Find all logs that have a status of Success.
  • { $.status = "Success" && $.eventType = "GetThingShadow" }
    • Find all logs that have a status of Success and an event type of GetThingShadow.

Success Action and Error Action

Either one will be triggered if set properly. For example, you can set SQS as the success action and Cloudwatch Log as the error action. If you don’t a message sent to SQS, then you can debug the failure reason in Cloudwatch Log.

Related Articles