npl
npl

Reputation: 11

Is there a efficient solution to access time series data from DynamoDB every hour?

I store sensor data (power and voltage measurements) coming from different devices in DynamoDB (partition key: deviceid and sort key: timestamp).

Every hour, I would like to access the data that has been stored in that time frame, do some calculations with it and store the results elsewhere.

My initial idea was to run a Lambda that would be triggered by a CloudWatch Rule, do the calculations and store the results in another DynamoDB table. I saw a similar question and the answer suggested DynamoDB Streams instead. But aren´t Streams supposed to be triggered every time an item is updated/deleted/inserted?. I understand there are conditions to invoke the Lambda with the Streams service that could allow me to do so every hour, but I don´t think this is the most efficient way to get around the problem.

So my question is if there is an efficient way/service to accomplish this?

Upvotes: 0

Views: 94

Answers (1)

Ross Williams
Ross Williams

Reputation: 632

DynamoDB Streams can efficiently process this data using batch windows and tumbling windows. These are built into DynamoDB stream. Batch windows can ensure the lambda function is only invoked once every 5 minutes or after 6MB of data, and tumbling windows allow you to perform running calculations for up to 15 minutes.

Upvotes: 1

Related Questions