AWS Lambda - Amazon Timestream

Amazon Timestream for LiveAnalytics will no longer be open to new customers starting June 20, 2025. If you would like to use Amazon Timestream for LiveAnalytics, sign up prior to that date. Existing customers can continue to use the service as normal. For more information, see Amazon Timestream for LiveAnalytics availability change.

AWS Lambda

You can create Lambda functions that interact with Timestream for LiveAnalytics. For example, you can create a Lambda function that runs at regular intervals to execute a query on Timestream and send an SNS notification based on the query results satisfying one or more criteria. To learn more about Lambda, see the AWS Lambda documentation.

Build AWS Lambda functions using Amazon Timestream for LiveAnalytics with Python

To build AWS Lambda functions using Amazon Timestream for LiveAnalytics with Python, follow the steps below.

  1. Create an IAM role for Lambda to assume that will grant the required permissions to access the Timestream Service, as outlined in Provide Timestream for LiveAnalytics access.

  2. Edit the trust relationship of the IAM role to add Lambda service. You can use the commands below to update an existing role so that AWS Lambda can assume it:

    1. Create the trust policy document:

      cat > Lambda-Role-Trust-Policy.json << EOF { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "lambda.amazonaws.com" ] }, "Action": "sts:AssumeRole" } ] } EOF
    2. Update the role from previous step with the trust document

      aws iam update-assume-role-policy --role-name <name_of_the_role_from_step_1> --policy-document file://Lambda-Role-Trust-Policy.json

Related references are at TimestreamWrite and TimestreamQuery.

Build AWS Lambda functions using Amazon Timestream for LiveAnalytics with JavaScript

To build AWS Lambda functions using Amazon Timestream for LiveAnalytics with JavaScript, follow the instructions outlined here.

Related references are at Timestream Write Client - AWS SDK for JavaScript v3 and Timestream Query Client - AWS SDK for JavaScript v3.

Build AWS Lambda functions using Amazon Timestream for LiveAnalytics with Go

To build AWS Lambda functions using Amazon Timestream for LiveAnalytics with Go, follow the instructions outlined here.

Related references are at timestreamwrite and timestreamquery.

Build AWS Lambda functions using Amazon Timestream for LiveAnalytics with C#

To build AWS Lambda functions using Amazon Timestream for LiveAnalytics with C#, follow the instructions outlined here.

Related references are at Amazon.TimestreamWrite and Amazon.TimestreamQuery.