You now create an AWS IoT rule which will store the messages from the device to AWS IoT core in an Amazon S3 bucket. AWS IoT uses publish-subscribe mechanism for the communication. The messages from the device are sent to a topic. The rule will read messages comming at the topic and save it in the Amazon S3 bucket.
-
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 stattement. 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 Store a message in an Amazon S3 bucket as an option and click on the Configure action button.
-
On the next screen, select dojo-iot-bucket-01 as the S3 bucket and enter device1data.txt as the key. If you created a bucket with different name, then select that bucket name as option. You are configuring rule to store the messages in the Amazon S3 bucket mentioned here. Click on the Select link for the choose role to authroize the rule action.
-
Select dojorole from the listed roles. It is the same role you created earlier. Click on the Select link again. 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. It is time to test the device to AWS IoT core communication in the next task.