Java - Amazon Timestream
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Amazon Timestream for LiveAnalytics will no longer be open to new customers starting June 20, 2025. If you would like to use Amazon Timestream for LiveAnalytics, sign up prior to that date. Existing customers can continue to use the service as normal. For more information, see Amazon Timestream for LiveAnalytics availability change.

Java

To get started with the Java 1.0 SDK and Amazon Timestream, complete the prerequisites, described below.

Once you've completed the necessary prerequisites for the Java SDK, you can get started with the Code samples.

Prerequisites

Before you get started with Java, you must do the following:

  1. Follow the Amazon setup instructions in Accessing Timestream for LiveAnalytics.

  2. Set up a Java development environment by downloading and installing the following:

  3. Configure your Amazon credentials and Region for development:

    • Set up your Amazon security credentials for use with the Amazon SDK for Java.

    • Set your Amazon Region to determine your default Timestream for LiveAnalytics endpoint.

Using Apache Maven

You can use Apache Maven to configure and build Amazon SDK for Java projects.

Note

To use Apache Maven, ensure your Java SDK and runtime are 1.8 or higher.

You can configure the Amazon SDK as a Maven dependency as described in Using the SDK with Apache Maven.

You can run compile and run your source code with the following command:

mvn clean compile mvn exec:java -Dexec.mainClass=<your source code Main class>
Note

<your source code Main class> is the path to your Java source code's main class.

Setting your Amazon credentials

The Amazon SDK for Java requires that you provide Amazon credentials to your application at runtime. The code examples in this guide assume that you are using an Amazon credentials file, as described in Set up Amazon Credentials and Region for Development in the Amazon SDK for Java Developer Guide.

The following is an example of an Amazon credentials file named ~/.aws/credentials, where the tilde character (~) represents your home directory.

[default] aws_access_key_id = Amazon access key ID goes here aws_secret_access_key = Secret key goes here