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.
Topics
- Build AWS Lambda functions using Amazon Timestream for LiveAnalytics with Python
- Build AWS Lambda functions using Amazon Timestream for LiveAnalytics with JavaScript
- Build AWS Lambda functions using Amazon Timestream for LiveAnalytics with Go
- Build AWS Lambda functions using Amazon Timestream for LiveAnalytics with C#
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.
-
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.
-
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:
-
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
-
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
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
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.