This sample application shows to
- Create table enabled with magnetic tier upsert
- Ingest data with multi measure records
- Create ScheduledQuery and interpret its run.
This application populates the table with ~63K rows of sample multi measure value data (provided as part of csv) , and run sample queries to jumpstart your evaluation and/or proof-of-concept applications with Amazon Timestream.
- Install Go
- Start module by generating
go.mod
andgo.sum
go mod init go_sample go mod tidy
-
- View list of arguments
go run scheduled-query-sample.go --help
- Run example to create scheduled query and run
go run scheduled-query-sample.go
- Run example to ingest the multi measure data in
sample-multi.csv
. DEFAULT value is../data/sample-multi.csv
go run scheduled-query-sample.go --csv_file_path="../data/sample-multi.csv"
- Run example to create scheduled query that fails on execution and generates an error report. DEFAULT value is false,
so it runs a valid query in the scheduled query sample
go run scheduled-query-sample.go --run_invalid_scheduled_query_flag=true
- Delete resources created by this script for creating/executing E2E scheduled query. DEFAULT value is true
go run scheduled-query-sample.go --delete_resources_after_execution_flag=true
- Skip deleting resources created by this script for further manual testing. DEFAULT value is true
go run scheduled-query-sample.go --delete_resources_after_execution_flag=false
- Run the sample application in a given region
go run scheduled-query-sample.go --region=us-east-2
NOTE: : Only when the CSV file path provided is valid, sample will run the ScheduledQuery E2E example.
- View list of arguments
-
- Create a Timestream database called devops_multi_sample_application with a table named
host_metrics_sample_application and inserts 4 records in the table.
The table host_metrics_sample_application contains the cpu utilization and memory utilization of many EC2 instances to
address devops use cases. The timestamps for the data points in the table have millisecond granularity. Set the flag
with a valid kms key to verify the updateDatabase API works:
go run crud-ingestion-sample.go --kms_key_id updatedKmsKeyId
go run crud-ingestion-sample.go
- Create a Timestream database called devops_multi_sample_application with a table named
host_metrics_sample_application and inserts 4 records in the table.
The table host_metrics_sample_application contains the cpu utilization and memory utilization of many EC2 instances to
address devops use cases. The timestamps for the data points in the table have millisecond granularity. Set the flag
with a valid kms key to verify the updateDatabase API works:
-
-
To insert ~63K rows in the table host_metrics_sample_application.
go run ingestion-csv-sample.go
-
Run the sample application in a given region
go run ingestion-csv-sample.go --region=us-east-2
NOTE: : If -region parameter is used for the ingesting data, please use the same region for rest of the two steps
-
To execute sample queries on the above ingested data. See
query-sample.go
for the GO code for parsing query results.go run query-sample.go
-
View list of arguments
go run query-sample.go --help
-
Run the sample application in a given region
go run query-sample.go --region=us-east-2
-
By default, responses from queries are printed on the cli and as well as to an output file, DEFAULT output file is
query_results.log
go run query-sample.go --outputfile="custom_output_file.log"
-
Run the cancel query in a given region
go run query-with-cancel.go --region=us-east-2 --query "select * from devops_multi_sample_application.host_metrics_sample_application"
-
To clean up resources created in STEP-3.1 which are S3 bucket, Timestream database and table.
go run cleanup-sample.go
-
Run the sample application in a given region
go run cleanup-sample.go --region=us-east-2
-
-
- This will demonstrate creating tables with composite partition keys (dimension partition key & measure partition key) and ingest records. Also demonstrate that records will be rejected if table has a dimension partition key with REQUIRED as enforcement and records are ingested without the partition key dimension.
- To run the sample application
go run composite-partition-key-sample.go