- Newest
- Most votes
- Most comments
To store data from your IoT device in Amazon Timestream every 15 minutes instead of every 2-3 seconds, you'll need to use a combination of AWS services. Unfortunately, you can't achieve this by simply modifying the IoT rule alone. Here's a step-by-step approach to accomplish your goal:
- Create an IoT Core rule:
- Go to the AWS IoT Core console
- Navigate to Message Routing > Rules
- Click on "Create rule"
- Set up a SQL query to select the data from your IoT topic
- For the rule action, choose to send the data to an AWS Lambda function
- Create a Lambda function:
- Go to the AWS Lambda console
- Create a new function
- Write code to: a. Receive data from IoT Core b. Buffer the data for 15 minutes c. After 15 minutes, batch the data and write it to Timestream
- Set up Amazon Timestream:
- Create a Timestream database and table to store your IoT data
- Configure permissions:
- Create an IAM role for your Lambda function with permissions to write to Timestream
- Ensure the IoT rule has permissions to invoke the Lambda function
- Test and monitor:
- Use the AWS IoT Core test client to publish messages and verify that data is being stored in Timestream at 15-minute intervals
This approach allows you to collect data frequently from your IoT device while controlling the rate at which it's written to Timestream. The Lambda function acts as a buffer, collecting data over 15 minutes before writing it as a batch to Timestream. This method gives you more control over the data ingestion process and can help optimize your Timestream usage.
Remember to handle error cases and implement appropriate logging and monitoring to ensure the system operates as expected.
Sources
Creating the AWS IoT rule to route IoT sensor data - AWS Prescriptive Guidance
https://docs.aws.amazon.com/prescriptive-guidance/latest/manage-iot-sensor-data-timestream/meta-inf/related-resources.html
Architecture for managing IoT sensor data - AWS Prescriptive Guidance
I suggest you use Amazon SQS or Amazon Kinesis Data Streams to batch the data, and then AWS Lambda to process the batches.
AWS IoT Core -> rule -> SQS or KDS -> Lambda -> Timestream
https://iotatlas.net/en/best_practices/aws/data_ingest/#decouple-ingest-from-processing-with-queues-and-streams https://docs.aws.amazon.com/wellarchitected/latest/iot-lens/ingestion-layer.html https://iotatlas.net/en/best_practices/aws/data_ingest/#batch-incoming-data-using-iot-core-rules-before-sending-downstream-to-other-aws-services
If you want the Lambda to run every 15 minutes at 0, 15, 30 and 45 minutes past the hour, you can use a scheduled Lambda: https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/scheduled-events-invoking-lambda-example.html
I just want to take the data which is arrived at every 15th min. Is it possible to do without SQS only with Lambda? Kindly share me steps if it's possible.
I have an IOT device which is pushing data every 2-3 sec to IOT core, but I want to store these data every 15mins to Timestream how I can achieve it. In IOT device there is no such option set pushing data time. Can I achieve it by just changing IOT rule or I have to use AWS Lambda service. Kindly suggest me with step-by-step configuration. What all AWS services are required to achieve this.
Amazon Timestream for LiveAnalytics will no longer be open to new customers starting June 20, 2025. I suggest you migrate your solution to a different database.
https://docs.aws.amazon.com/timestream/latest/developerguide/what-is-timestream.html
I just want to take the data which is arrived at every 15th min. Is it possible to do without SQS only with Lambda?
Yes, that is possible to do without the SQS. You can use Amazon EventBridge Scheduler to invoke your Lambda every 15th min - please check the Rate-based scheduler documentation:
https://docs.aws.amazon.com/scheduler/latest/UserGuide/schedule-types.html#rate-based
IMPORTANT: Please note that you will lose every message sent between those 15-minute intervals. If you want to store every message at a 15-minute interval, you need to use some kind of temporary storage or queue (ie. SQS)
Relevant content
- asked 4 years ago

who to batch data through AWS lambda services. share the Steps