Getting Data from IoT Core to S3 via Kinesis
Setting up IoT Act Rule
In AWS IoT Core, on the left hand navigation menu, scroll down to click on “Act” and then click on “Rules”. It should be highlighted in orange if you’ve already opened it.
Creating the Rule
To create the required rule to dump the MQTT messages onto the Kinesis data stream, click on the “create” located on the right hand side.
In the Create rule window, provide a name and description for the rule.
We can select the SQL version you’re most comfortable with in the Rule Query Statement. In our case we’re using “2016-03-23”
When providing the “Rule Query Statement” provide the follow:
SELECT *, topic(3) as buoy_id FROM 'aws/+/+/data/#'
We’re adding in buoy_id into the message so we know which physical buoy the data is coming from. Please refer to: https://bcit-reseach-long-term-issp.github.io/docs/smart-device/communication-protocol/mqtt#broker-namespace-topics for more information on the topic formatting.
Now continuing on, In the “Set one or more actions” click on “Add Action”
More options will appear, we’re looking for “Send a message to an Amazon Kinesis Stream”. Select it and scroll down and click on the “Configure action” button.
In the configure Action menu, select the Kinesis data stream you wish to dump data on, via the “Choose a resource” drop down. If you cannot find the AWS resource, you can always create a new data stream. Refer to https://bcit-reseach-long-term-issp.github.io/docs/cloud/kinesis#creating-data-stream if you require more information about setting up a new data stream.
In the partition key, we can leave it as what they suggest:
${newuuid()}
In the roles section, change it to “EMA-C22-CloudServices”
Then finish up by clicking on add action
We can setup an optional error action but we haven’t set it up yet. Perhaps this can be updated down the road.
Once done, click on the create rule button on the buttom.