

終止支援通知：在 2025 年 12 月 15 日， AWS 將終止對 的支援 AWS IoT Analytics。2025 年 12 月 15 日之後，您將無法再存取 AWS IoT Analytics 主控台或 AWS IoT Analytics 資源。如需詳細資訊，請參閱[AWS IoT Analytics 終止支援](https://docs.aws.amazon.com/iotanalytics/latest/userguide/iotanalytics-end-of-support.html)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 在 AWS IoT Analytics (AWS CLI) 中存取資料集內容
<a name="preview-dataset-content-cli"></a>

如果您的資料集包含任何資料，您可以預覽和下載 SQL 查詢結果。

此處顯示的範例使用 AWS Command Line Interface (AWS CLI)。如需 的詳細資訊 AWS CLI，請參閱 [AWS Command Line Interface 使用者指南](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html)。如需 CLI 命令的詳細資訊 AWS IoT Analytics，請參閱《 *AWS Command Line Interface 參考*》中的 [iotanalytics](https://docs.aws.amazon.com/cli/latest/reference/iotanalytics/index.html)。

**存取 AWS IoT Analytics 資料集結果 (AWS CLI)**

1. 執行下列`get-dataset-content`命令以檢視查詢的結果。

   ```
   aws iotanalytics get-dataset-content --dataset-name my_iotsitewise_dataset
   ```

1. 如果您的資料集包含任何資料，則來自 的輸出`get-dataset-content`在 `status` `"state": "SUCCEEDED"`欄位中具有 ，例如在下列範例中。

   ```
   {
       "timestamp": 1508189965.746,
       "entries": [
           {
             "entryName": "my_entry_name",
             "dataURI": "https://aws-iot-analytics-datasets-f7253800-859a-472c-aa33-e23998b31261.s3.amazonaws.com/results/f881f855-c873-49ce-abd9-b50e9611b71f.csv?X-Amz-"
             
           }
       ],
       "status": {
         "state": "SUCCEEDED",
         "reason": "A useful comment."
       }
   }
   ```

1. 的輸出`get-dataset-content`包含 `dataURI`，這是輸出結果的簽章 URL。它的有效期間很短 (幾個小時)。請造訪 `dataURI` URL 以存取您的 SQL 查詢結果。
**注意**  
 根據您的工作流程，在存取內容前您可能會想要一律呼叫 `get-dataset-content`，因為呼叫此命令會產生新的已簽署 URL。