Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
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.
Query SDK client
You can use the following code snippets to create a Timestream client for the Query SDK.
The Query SDK is used to query your existing time series data stored in Timestream.
These code snippets are based on full sample applications on GitHub.
For more information about how to get started with the sample applications, see Sample application.
- Java
-
private static AmazonTimestreamQuery buildQueryClient() {
AmazonTimestreamQuery client = AmazonTimestreamQueryClient.builder().withRegion("us-east-1").build();
return client;
}
- Java v2
-
private static TimestreamQueryClient buildQueryClient() {
return TimestreamQueryClient.builder()
.region(Region.US_EAST_1)
.build();
}
- Go
-
sess, err := session.NewSession(&aws.Config{Region: aws.String("us-east-1")})
- Python
-
query_client = session.client('timestream-query')
- Node.js
-
The following snippet uses Amazon SDK for JavaScript v3. For more information about how to install the client and usage, see Timestream Query Client - ,Amazon SDK for JavaScript v3.
An additional command import is shown here. The QueryCommand
import is not required to create the client.
import { TimestreamQueryClient, QueryCommand } from "@aws-sdk/client-timestream-query";
const queryClient = new TimestreamQueryClient({ region: "us-east-1" });
The following snippet uses the Amazon SDK for JavaScript V2 style. It is based on the sample application at Node.js sample Amazon Timestream for LiveAnalytics application on GitHub.
queryClient = new AWS.TimestreamQuery();
- .NET
-
var queryClientConfig = new AmazonTimestreamQueryConfig
{
RegionEndpoint = RegionEndpoint.USEast1
};
var queryClient = new AmazonTimestreamQueryClient(queryClientConfig);