

如需與 Amazon Timestream for LiveAnalytics 類似的功能，請考慮使用 Amazon Timestream for InfluxDB。它提供簡化的資料擷取和單一位數毫秒查詢回應時間，以進行即時分析。[在這裡](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 值 (s) 期間使用傳回的端點。實作程序如下所述。

**注意**  
確保您熟悉[用量備註](#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)請求，取得您要呼叫的 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))。

   1.  使用下列兩個端點之一，為 建立[https://docs.aws.amazon.com/timestream/latest/developerguide/API_DescribeEndpoints.html](https://docs.aws.amazon.com/timestream/latest/developerguide/API_DescribeEndpoints.html)對應至所關注 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)) 的請求。請求沒有輸入參數。請務必閱讀以下備註。  
*寫入 SDK：*  

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

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

      區域 的 CLI 呼叫範例`us-east-1`如下。

      ```
      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 "Host" 標頭*也必須*包含 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 Live Analytics API 呼叫的端點清單。
+  成功回應時，清單中應該至少有一個端點。如果清單中有多個端點，則任何端點都同樣可用於 API 呼叫，而且發起人可以選擇隨機使用的端點。
+ 除了端點的 DNS 地址之外，清單中的每個端點都會指定允許使用以分鐘為單位指定端點的存留時間 (TTL)。
+ 應在傳回的 TTL 值指定的時間內快取和重複使用端點 （以分鐘為單位）。TTL 過期後，應對 **DescribeEndpoints** 進行新的呼叫，以重新整理要使用的端點，因為 TTL 過期後，端點將無法再運作。