integrating IoT topic incoming JSON array of measurments with timestream


Hi, I am trying to integrate IoT rule with timestream. I managed to handle a case when I have one incoming measurement per messages, but for network optimisation (or something) we receive packed measurements as JSON array (examples below). Is there a way to compose SQL code which will parse incoming array and put multiple measurements into timestream db?

Single measurement example:

{ "value": 335, "dataId": "Wroclaw1" "takenAt": "2022-02-01T11:40:46.770Z" }

my case:

[[{ "value": 35, "dataId": "Wroclaw1" "takenAt": "2022-02-01T11:40:46.770Z" }, { "value": 37, "dataId": "Wroclaw2" "takenAt": "2022-02-01T11:41:49.260Z" }]]

asked 2 years ago509 views
1 Answer

Hi kaczkaikielbasa!

I am not sure if you can use SQL to access a Timestream - as for the documentation below, you can use API or AWS SDKs to do that (chapter "Accessing Timestream").

Depending on the amount and frequency of the data, you could try testing parsing using the language of your choice from available AWS SDKs and put that on the AWS Lambda (just to try it out, later on - in production - you would probably go for the EC2 or microservices).

Please check out the code samples that are available in the documentation as well.

answered 2 years ago
  • not the issue I was asking about. I am not accessing timestream with SQL. I want AWS IoT rule SQL to parse incoming JSON array to pass measurements to timestream. It is possible with single measurement data.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions