Handle AWS IoT Messages using AWS Lambda

   Go back to the Task List

  [« 4: Create Lambda Function ]    [6: Publish Messages from the Device »]

5: Create IoT Rule

You now create an AWS IoT rule which will call Lambda function to process the messages from the device to AWS IoT core.

  1. On the AWS IoT Core console. Click on Rules menu under Act in the left and then click on the Create a rule button.

    Policy Menu

  2. On the next screen, enter dojoiotrule for the rule name. Type in SELECT * FROM ‘iot/dojoinbound’ for the Rule query statement. In this configuration, the topic name is iot/dojoinbound. The rule is reading all the messages coming to the topic. You also have choice to filter the messages for the rule. Next, click on the Add action button to add action for the rule.

    Policy Menu

  3. On the next screen, there are many different types of actions to handle the messages. Select Send a message to a Lambda function as an option and click on the Configure action button.

    Policy Menu

  4. On the next screen, select dojolambdafunction as the function name and click on the Add action button.

    Policy Menu

  5. It comes back to the rule configuration screen with the action configured. Click on the Create rule button in the bottom of the screen.

  6. The rule is created in no time. All set. In the next step, you will use MQTT client as the device simulator to send messages to the AWS IoT Core.