

要获得与亚马逊 Timestream 类似的功能 LiveAnalytics，可以考虑适用于 InfluxDB 的亚马逊 Timestream。适用于 InfluxDB 的 Amazon Timestream 提供简化的数据摄取和个位数毫秒级的查询响应时间，以实现实时分析。点击[此处](https://docs.aws.amazon.com//timestream/latest/developerguide/timestream-for-influxdb.html)了解更多信息。

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 实施端点发现模式
<a name="Using-API.endpoint-discovery.describe-endpoints.implementation"></a>

 要实现端点发现模式，请选择一个 API（写入或查询），创建**DescribeEndpoints**请求，然后在返回的 TTL 值持续时间内使用返回的端点。实施过程如下所述。

**注意**  
确保您熟悉[使用说明](#Using-API.endpoint-discovery.describe-endpoints.usage-notes)。

## 实施过程
<a name="Using-API.endpoint-discovery.describe-endpoints.implementation.procedure"></a>

1.  使用 [https://docs.aws.amazon.com/timestream/latest/developerguide/API_DescribeEndpoints.html](https://docs.aws.amazon.com/timestream/latest/developerguide/API_DescribeEndpoints.html) 请求，获取您要对其进行调用（[写入](https://docs.aws.amazon.com/timestream/latest/developerguide/API_Operations_Amazon_Timestream_Write.html)或[查询](https://docs.aws.amazon.com/timestream/latest/developerguide/API_Operations_Amazon_Timestream_Query.html)）的 API 的端点。

   1.  使用下述两个端点之一，创建与目标 API（[写入](https://docs.aws.amazon.com/timestream/latest/developerguide/API_Operations_Amazon_Timestream_Write.html)或[查询](https://docs.aws.amazon.com/timestream/latest/developerguide/API_Operations_Amazon_Timestream_Query.html)）相对应的 [https://docs.aws.amazon.com/timestream/latest/developerguide/API_DescribeEndpoints.html](https://docs.aws.amazon.com/timestream/latest/developerguide/API_DescribeEndpoints.html) 请求。该请求没有输入参数。请务必阅读以下说明。  
*写入 SDK：*  

      ```
      ingest.timestream.<region>.amazonaws.com
      ```  
*查询 SDK：*  

      ```
      query.timestream.<region>.amazonaws.com
      ```

      以下是区域 `us-east-1` 的 CLI 调用示例。

      ```
      REGION_ENDPOINT="https://query.timestream.us-east-1.amazonaws.com"
      REGION=us-east-1
      aws timestream-write describe-endpoints \
      --endpoint-url $REGION_ENDPOINT \
      --region $REGION
      ```
**注意**  
 HTTP“主机”标头还*必须*包含 API 端点。如果未填充该标头，则请求将失败。这是所有 HTTP/1.1 请求的标准要求。如果使用支持 1.1 或更高版本的 HTTP 库，HTTP 库应自动为您填充标头。
**注意**  
*<region>*用请求所在区域的区域标识符替换，例如 `us-east-1`

   1. 解析响应，以提取端点并缓存 TTL 值。响应是一个或多个 [`Endpoint` 对象](https://docs.aws.amazon.com/timestream/latest/developerguide/API_Endpoint.html)的数组。每个 `Endpoint` 对象都包含一个端点地址（`Address`）和该端点的 TTL（`CachePeriodInMinutes`）。

1.  缓存端点，其 TTL 不超过指定值。

1.  TTL 到期后，请从实施步骤 1 重新开始，以检索新的端点。

## 端点发现模式的使用说明
<a name="Using-API.endpoint-discovery.describe-endpoints.usage-notes"></a>
+ 该**DescribeEndpoints**操作是 Timestream Live Analytics 区域端点识别的唯一操作。
+ 响应包含用于调用 Timestream LiveAnalytics API 的端点列表。
+  成功响应后，列表应至少包含一个端点。如果列表中包含多个端点，则其中任意一个均可用于 API 调用，调用者可随机选择使用其中一个端点。
+ 除端点的 DNS 地址外，列表中的每个端点还将指定允许使用该端点的生存时间（TTL），以分钟为单位。
+ 该端点应进行缓存和重复使用，时长由返回的 TTL 值所指定（以分钟为单位）。TTL 过期后，**DescribeEndpoints**应重新调用以刷新要使用的终端节点，因为 TTL 过期后终端节点将不再起作用。