AWS IoT Analytics

AWS IoT Analytics automates the steps required to analyse data from IoT devices. It filters, transforms, and enriches IoT data before storing it in a time-series data store for analysis.

In this example you will transfer your asset property values to AWS IoT Analytics. In IoT Analytics the data should be stored as a table with the following columns.

type asset_id property_id timestamp quality value valuetype

When JSON messages are received by an IoT Analytics channel the values from the keys in the first level of the JSON object will be stored as columns.

SiteWise emits messages like the following to MQTT topics.

{
  "type": "PropertyValueUpdate",
  "payload": {
    "assetId": "5d42fac2-6575-4503-829b-4b21ddc5fe8f",
    "propertyId": "5b79096a-f2b4-45a0-b0e1-40c8ec7c5d88",
    "values": [
      {
        "timestamp": {
          "timeInSeconds": 1576170249,
          "offsetInNanos": 417000000
        },
        "quality": "GOOD",
        "value": {
          "doubleValue": 92.50262543159513
        }
      }
    ]
  }
}

Are you seeing the challenge with this message? It would be stored as a table with two columns.

type payload

To get to the storage format mentioned above these JSON messages must be flattened.

You will create an IoT Analytics setup composed of a pipeline, channel, data store and data set.

To flatten the messages you will create a Lambda function and add it as pipeline activity.