Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅
中国的 Amazon Web Services 服务入门
(PDF)。
要获得与亚马逊 Timestream 类似的功能 LiveAnalytics,可以考虑适用于 InfluxDB 的亚马逊 Timestream。它为实时分析提供了简化的数据摄取和个位数毫秒的查询响应时间。点击此处了解更多。
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
查询 SDK 客户端
您可以使用以下代码片段为 Query SDK 创建 Timestream 客户端。查询 SDK 用于查询存储在 Timestream 中的现有时间序列数据。
- 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
-
以下代码段使用 Amazon 适用于 JavaScript v3 的 SDK。有关如何安装客户端和用法的更多信息,请参阅 Timestream 查询客户端-,Amazon 适用于 JavaScript v3 的 SDK。
此处显示了其他命令导入。创建客户端不需要QueryCommand
导入。
import { TimestreamQueryClient, QueryCommand } from "@aws-sdk/client-timestream-query";
const queryClient = new TimestreamQueryClient({ region: "us-east-1" });
以下代码段使用适用于 JavaScript V2 的 Amazon SDK 风格。它基于 Node.js 示例 Amazon Timestream 中的示例 LiveAnalytics 应用程序,供其上使用。 GitHub
queryClient = new AWS.TimestreamQuery();
- .NET
-
var queryClientConfig = new AmazonTimestreamQueryConfig
{
RegionEndpoint = RegionEndpoint.USEast1
};
var queryClient = new AmazonTimestreamQueryClient(queryClientConfig);