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.
-
On the AWS IoT Core console. Click on Rules menu under Act in the left and then click on the Create a rule button.
-
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.
-
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.
-
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.
-
It comes back to the rule configuration screen with the action configured. Click on the Create rule button in the bottom of the screen.
-
The rule is created in no time. All set. Let the Device publish messages to the Timestream database table in the next task.