CompanyDecember 14, 2022

Accelerate your Cassandra development and automation with the Astra CLI

Accelerate your Cassandra development and automation with the Astra CLI

We are pleased to announce the release of the new DataStax Astra Command Line Interface (CLI). For Apache Cassandra developers using DataStax Astra DB, the Astra CLI is a one stop shop for managing your Astra resources through scripts or in your local terminal. It covers a wide variety of capabilities including:

  • Creation and management for Astra DB & Astra Streaming artifacts
  • Querying & data loading
  • Organization and user management
  • Security and token configuration

Astra Command Line Interface (CLI)Figure 1: Astra Command Line Interface (CLI)

Many developers prefer to work from the command line and having to switch contexts to a web UI can break up their development flow. The Astra CLI can run from any terminal or embedded integrated development environment (IDE) console to quickly connect to your Astra account and artifacts. This allows you to easily run simple development tasks like creating or resuming a database, checking the status of a streaming tenant, or running a query. 

For DevOps engineers, the CLI provides the best way to streamline automation scripts which perform typical maintenance tasks or run test scenarios, which can then be incorporated into your CI/CD processes. With just a few commands, you can provision a new Astra database, load data with DSBulk, run tests, validate with queries using CQLSH, manage and configure Astra DB, and tear down the environment. 

For management, configuration and operation of Astra DB, the CLI leverages the functionality provided by Astra DB’s REST-based DevOps API, much in the same way the web-based Astra DB Console does.  

Installation

To get started with the Astra CLI on MAC laptops, run the following Homebrew installation command:

brew install datastax/astra-cli/astra-cli

This will install the Astra CLI through the Homebrew package manager. Additional installation options for Linux and Windows can be found here.

Once installed, run the setup utility to authenticate to your Astra account using your application token:

The Astra CLI is self-documented so that you can quickly lookup the commands and their options, either from the embedded help system or by using TAB completion. For example, to get help on database commands, just use:

astra help db

The CLI will also download, install, and configure additional utilities as needed, such as:

  • CQLSH to execute CQL queries
  • DSBulk to load and unload data
  • pulsar-shell to configure Astra Streaming tenants, producers, and consumers

Now we are off to the races and ready to work with Astra. 

Create your first database

To create a new database simply provide the database and optional keyspace name. 

astra db create demo

Once the database is created, you can list your databases using list.

astra db list

Check out the video below to learn about data loading and querying:

Summary

The Astra CLI is a lightweight tool that fits neatly into any developer toolbox. Whether you are writing automated test suites, release management pipelines, or just want to administrate Astra DB and Astra Streaming from the keyboard versus your mouse, the Astra CLI is here to help. 

While we have only scratched the surface, there is so much more that you can do with the CLI including managing multiple organizations, defining users and roles, and automating your Astra Streaming lifecycle. For more information, check out the resources below or try out one of the new Getting Started guides in Astra itself.

This is only the first release, but you can expect more features and functionality for the Astra CLI in the near future. We’ll add support for more package managers which simplify installation like SDKMan and Yum, security configuration for Private Link with AWS and Azure, and configuration options for Change Data Capture (CDC).

Happy scripting!

Resources

One-stop Data API for Production GenAI

Astra DB gives JavaScript developers a complete data API and out-of-the-box integrations that make it easier to build production RAG apps with high relevancy and low latency.