Prerequisites
To follow the steps on this page:- Create a target with the Real-time analytics capability enabled. You need your connection details. This procedure also works for .
- Set up an AWS Account.
- Install and configure AWS CLI.
- Install NodeJS v18.x or later.
Prepare your Tiger Cloud service to ingest data from AWS Lambda
Create a table in to store time-series data.-
Connect to your
For , open an SQL editor in . For , use
psql. -
Create a to store sensor data
s are tables that automatically partition your data by time. You interact
with s in the same way as regular tables, but with extra features that make managing your
time-series data much easier.
When you create a using CREATE TABLE … WITH …, the default partitioning column is automatically the first column with a timestamp data type. Also, creates a columnstore policy that automatically converts your data to the , after an interval equal to the value of the chunk_interval, defined through
compress_afterin the policy. This columnar format enables fast scanning and aggregation, optimizing performance for analytical workloads while also saving significant storage space. In the conversion, chunks are compressed by up to 98%, and organized for efficient, large-scale queries. You can customize this policy later using alter_job. However, to changeafterorcreated_before, the compression settings, or the the policy is acting on, you must remove the columnstore policy and add a new one. You can also manually convert chunks in a to the .
Create the code to inject data into a Tiger Cloud service
Write an AWS Lambda function in a Node.js project that processes and inserts time-series data into a .-
Initialize a new Node.js project to hold your Lambda function
-
Install the client library in your project
-
Write a Lambda Function that inserts data into your
Create a file named
index.js, then add the following code:
Deploy your Node project to AWS Lambda
To create an AWS Lambda function that injects data into your :-
Compress your code into a
.zip -
Deploy to AWS Lambda
In the following example, replace
<IAM_ROLE_ARN>with your AWS IAM credentials, then use AWS CLI to create a Lambda function for your project: -
Set up environment variables
In the following example, use your connection details to add your connection settings to your Lambda function:
-
Test your AWS Lambda function
-
Invoke the Lambda function and send some data to your :
-
Verify that the data is in your .
Open an SQL editor and check the
sensor_datatable:You see something like:time sensor_id value 2025-02-10 10:58:45.134912+00 sensor-123 42.5
-
Invoke the Lambda function and send some data to your :