2

Following is the data in my message.

{
  "time_epoch": 1604489437,
  "temperature": 100,
  "device_id": "TempSensor1"
}

I have an IoT core rule that takes this msg and has an action to send it to the Timestream db table.

In the IoT core rule - I have configured device_id to be the dimension and time_epoch to be the timestamp. Screenshot below:

enter image description here

Problem: When the msg reaches the Timestream db table, the device_id is correctly showing as dimension. The time_epoch is correctly showing under time column. However all 3 - device_id, temperature and time_epoch are getting shown as measures. Screenshot below:

enter image description here

I imagined that - since I have specified in the IoT core rule action that device_id is the dimension and time_epoch is the timestamp, then AWS Timestream should have been smart enough to not include both of these as the measure.

How can I instruct timestream db to not consider device_id and time_epoch as measures; and only consider temperature as the measure? I tried editing the table settings but there I could not find any option to specify/configure the measures.

variable
  • 8,262
  • 9
  • 95
  • 215
  • Same question here. I've consulted this docs from Iot core https://docs.aws.amazon.com/iot/latest/developerguide/timestream-rule-action.html It seems this is the default behavior of ingesting data to timestream. – Cảnh Toàn Nguyễn Nov 15 '20 at 13:26

1 Answers1

2

I assume you are doing something like:

SELECT * FROM /your/topic

What you want to do is:

SELECT temperature FROM /your/topic

You will have to edit your dimensions to now use builtin functions instead of your SQL query results. Essentially, use ${clientId()} for device_id and ${timestamp()} for time. See documentation for a list of available substitution templates.

You should then see the table you expect to see.

The reason you are seeing the spurious measures currently is because, as the docs state, Timestream converts each key of the JSON into its own measurement record.