Connect to the CQL shell for Astra DB

To run CQL statements against your Astra DB Serverless databases, you can use the CQL shell (cqlsh), a Cassandra driver, or the Data API. This guide explains how to use the CQL shell (cqlsh) to interact with your Astra DB databases. For information about other connection methods, see Cassandra Query Language (CQL) for Astra DB.

The CQL shell (cqlsh) is a utility that you can use to issue CQL and cqlsh commands to your Astra DB Serverless databases.

You can use the CQL console in the Astra Portal, or you can install the CQL shell utility with the Astra CLI.

Use the CQL console (embedded CQL shell)

In the Astra Portal, each Astra DB Serverless database has access to the CQL console, which is an embedded CQL shell instance. You can use the CQL console to run CQL and cqlsh commands on your databases directly from your browser without installing any additional software.

  1. In the Astra Portal, click the name of the database that you want to connect to.

  2. Click CQL console to open the embedded CQL shell in a new tab.

    Your session is automatically authenticated and connected based on the selected database and your assigned role in the Astra Portal.

  3. Wait for the token@cqlsh> prompt to appear.

    This prompt indicates that CQL shell is connected to your database, and you can start sending CQL and cqlsh commands to your database.

  4. Optional: For multi-region databases, use the region menu to access data from a secondary region.

    Typically, you change regions only if the primary region is geographically distant from your machine. Due to Astra DB’s eventual consistency model, changes to data in any region are eventually replicated to the database’s other regions.

Alternatively, after you sign in to the Astra Portal, you can directly access the built-in CQL console app at DATABASE_ID-REGION.apps.astra.datastax.com/cqlsh. The database ID and region set the context for the CQL console session. If you use custom domains, replace astra.datastax.com with your custom domain.

Use the standalone CQL shell

For remote programmatic access, use the Astra CLI to download, install, and use the standalone CQL shell utility:

  1. Install the Astra CLI.

  2. Connect the Astra CLI to a database.

    After you run astra setup and create a configuration profile, the same connection details and options are used to run astra db cqlsh commands. For example, the application token in your Astra CLI configuration profile is automatically used for the CQL shell --password option. Unless you want to use a different token, you don’t need to explicitly set --password for every astra db cqlsh command.

  3. Run astra db cqlsh start DB_ID or any other astra db cqlsh command.

    The first time that you run an astra db cqlsh command, Astra CLI automatically installs the CQL shell.

    All astra db cqlsh commands require a database ID. Many cqlsh options are inherited from Astra CLI, such as connection details from your Astra CLI configuration profile and output preferences like --color. You can add or override any cqlsh options by appending them to your astra db cqlsh commands.

    For more information and examples, see the Astra CLI CQL shell quickstart.

Was this helpful?

Give Feedback

How can we improve the documentation?

© Copyright IBM Corporation 2026 | Privacy policy | Terms of use |  Manage Privacy Choices

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: Contact IBM