Access dataset content in Amazon IoT Analytics (Amazon CLI)
If your dataset contains any data, you can preview and download your SQL query results.
The examples shown here use the Amazon Command Line Interface (Amazon CLI). For more information on the Amazon CLI, see the Amazon Command Line Interface User Guide. For more information about the CLI commands available for Amazon IoT Analytics, see iotanalytics in the Amazon Command Line Interface Reference.
To access your Amazon IoT Analytics dataset results (Amazon CLI)
Run the following
get-dataset-content
command to view the result of your query.aws iotanalytics get-dataset-content --dataset-name my_iotsitewise_dataset
-
If your dataset contains any data, then the output from
get-dataset-content
, has"state": "SUCCEEDED"
in thestatus
field, such as in the following example.{ "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." } }
The output from
get-dataset-content
includes adataURI
, which is a signed URL to the output results. It is valid for a short period of time (a few hours). Visit thedataURI
URL to access your SQL query results.Note
Depending on your workflow, you might want to always call
get-dataset-content
before you access the content because calling this command generates a new signed URL.