Skip to main content

Connect via Presto CLI

This page will help you download and configure the Presto command-line interface (CLI) to query your Presto Clusters. The official Presto CLI documentation can be found here.

Step 0: Identify your Presto cluster version and endpoint

This step is for Ahana Cloud for Presto.

  1. Log into your Ahana Cloud SaaS Console.
  2. Go to Clusters.
  3. Make note of the Presto cluster version and endpoint under the Information and Connection Details section, respectively.
  4. You will also need your Presto cluster username and password.

Ahana Presto connection details

Step 1: Download the Presto CLI executable JAR

  1. Navigate to the Presto CLI build artifact page for your Presto version (or higher). The Presto CLI build artifacts are hosted at: https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/ with a distinct directory for each Presto version. For example, if you wanted the 0.251 Presto version, you would navigate to https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/0.251/.
  2. Download the executable JAR. This file is called presto-cli-{version}-executable.jar.

Step 2: Rename and make executable

The CLI is a self-executing JAR file.

  1. For convenience, rename your executable JAR to presto.
  2. Make the JAR executable with chmod +x presto.

You will need a Java Runtime Environment (JRE) on your local machine to to run the CLI. Make sure you have at least Java 8 or higher installed on your local machine.

Step 3: Connect to your Presto cluster

  1. Using your Presto cluster endpoint and username, you can connect the Presto CLI to your cluster with the following command:
./presto --server https://reportingcluster.my-domain.cp.ahana.cloud --user Admin --password

  1. You will be prompted for your password.

  2. A successful connection with show you a Presto command line prompt: presto>. You can now submit queries to your cluster. For example:

presto> show catalogs;
Catalog
--------------------
ahana_hive
jmx
system
tpcds
tpch

Connect with an Identity Provider

To query your Presto cluster with the Presto CLI with an identity provider, you will need:

To start the Presto CLI, run a command similar to the following:

./presto --external-authentication --server https://reportingcluster.my-domain.cp.ahana.cloud --user oidc-identity

--external-authentication, --server, and --user are all required.

Use the Presto endpoint of your Presto cluster for the URL following --server in the example.

Substitute the email address of the user parameter of your identity configured in your identity provider for oidc-identity.

When you submit a query such as show catalogs;, the authentication process begins and the Presto CLI interacts with your identity provider. If you are not currently logged in to your identity provider, the log in page for your identity provider opens in a web page. The Okta log in window is provided as an example.

Okta log in

Once logged in to your identity provider, the web page will show your authentication was successful similar to this example:

Authentication successful

At the presto> prompt of the Presto CLI, your query will have completed.