This sample application shows how you can create a database and table, populate the table with ~126K rows of sample data, and run sample queries to jumpstart your evaluation and/or proof-of-concept applications with Amazon Timestream.
Ensure your Java SDK and runtime are 1.8 or higher.
-
Install maven: https://maven.apache.org/install.html
-
Go to Timestream Java V2 sample app directory
-
You can compile and run your source code with the below command:
mvn clean compile mvn exec:java -Dexec.mainClass="com.amazonaws.services.timestream.Main" -Dexec.args="--type BASIC --region us-west-2 --skip_deletion"
NOTE: You might need to change the version of timestreamwrite and timestreamquery dependencies in
pom.xml
file based on the version of SDK jar you are using. -
To run with sample application and ingest data from sample csv data file, you can use the following command:
mvn clean compile mvn exec:java -Dexec.mainClass="com.amazonaws.services.timestream.Main" -Dexec.args="--type BASIC --region us-west-2 --skip_deletion --inputFile ../data/sample.csv"
-
To run with sample application and include database CMK update to a kms "valid-kms-id" registered in your account run
mvn clean compile mvn exec:java -Dexec.mainClass="com.amazonaws.services.timestream.Main" -Dexec.args="--type BASIC --region us-west-2 --skip_deletion --kmsId valid-kms-id"
-
To run sample application for unload queries
mvn clean compile mvn exec:java -Dexec.mainClass="com.amazonaws.services.timestream.Main" -Dexec.args="--type UNLOAD --region us-west-2 --skip_deletion --inputFile ../data/sample_unload.csv"
-
To run sample application for composite partition key
mvn clean compile mvn exec:java -Dexec.mainClass="com.amazonaws.services.timestream.Main" -Dexec.args="--type COMPOSITE_PARTITION_KEY --region us-west-2 --skip_deletion"