AWS IoT Core Integration with Amazon Timestream

   Go back to the Task List

  [« 4: Create Timestream Database ]    [6: Publish Messages from the Device »]

5: Create IoT Rule

You now create an AWS IoT rule which will store the messages from the device to AWS IoT core in an Amazon Timestream database table.

  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 Write a message into a Timestream table as an option and click on the Configure action button.

    Policy Menu

  4. On the next screen, select dojodatabase as the database and select dojotable as the table. You also add two dimensions as an example - devicename = dojodevice1 and devicesite = factory1. You can add more than one dimension to contextualize the messages. Like in this example, we are adding device name and device deployment site as two dimensions. Select dojoiotrole as the IAM role. Finally 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. Let the Device publish messages to the Timestream database table in the next task.