Install or update the Astra CLI
Install the Astra CLI to create and manage Astra DB databases and Astra Streaming tenants from the command line.
Platform compatibility
The Astra CLI supports the following operating systems:
Operating System | Architecture |
---|---|
Linux |
x86_64 |
macOS |
x86_64, ARM64 |
Microsoft Windows |
x86_64 Requires Windows Subsystem for Linux (WSL) |
Install the Astra CLI
Install the Astra CLI using your preferred method:
-
Homebrew
-
curl
-
JVM
-
Docker
You can use Homebrew to install the Astra CLI on macOS and Linux.
-
You must have Homebrew installed.
-
On macOS, you must set your macOS app security settings to Allow applications from App Store & Known Developers.
-
Make sure Homebrew is up to date:
brew update
-
Install the Astra CLI:
brew install datastax/astra-cli/astra-cli
Result
==> Fetching datastax/astra-cli/astra-cli ==> Downloading https://github.com/datastax/astra-cli/releases/download/0.6/astra-cli-0.6.arm64_sonoma.bottle.tar.gz Already downloaded: /Users/USERNAME/Library/Caches/Homebrew/downloads/ca763b5f440dad257d707b2e705e98bd5a66912662fa95ae5ef417e749a2b08a--astra-cli-0.6.arm64_sonoma.bottle.tar.gz ==> Installing astra-cli from datastax/astra-cli ==> Pouring astra-cli-0.6.arm64_sonoma.bottle.tar.gz ==> Caveats ------------------------ ENABLE AUTOCOMPLETION ------------------------- To enable Bash completion for Astra CLI (and other brew formulae when enable, add the following to your shell configuration file (e.g. ~/.zshrc): if [ -f /opt/homebrew/etc/bash_completion.d ]; then . /opt/homebrew/etc/bash_completion.d fi Once added, reload your shell or run: source /opt/homebrew/etc/bash_completion.d This will ensure the Bash completion script for Astra CLI is loaded. ------------------- SPECIAL COMMANDS ------------------- - CQLSH: You must have python 3.7+ but less than 3.12, cqlsh is still not compatible with 3.12, downgrade if needed - DSBULK: You must have java11+ installm the cli is pulling regular dsbulk ==> Summary 🍺 /opt/homebrew/Cellar/astra-cli/0.6: 4 files, 44.4MB ==> Running `brew cleanup astra-cli`... Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP. Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
-
Confirm that the Astra CLI is installed:
astra --version
Result
0.6
The command returns the Astra CLI version that is installed.
macOS security alertsThe first time you run the
astra
command after installing or updating the Astra CLI on macOS, the operating system may display the following alert:“astra” Not Opened
.If you encounter this alert, then you must override your Mac security settings before you can run Astra CLI commands. See the Apple support documentation for more information.
-
(Optional) If you haven’t done so already, enable
brew
shell completion.The Astra CLI Homebrew formula installs a completion file named
astra
in the Homebrew-managed completions directory. If you have shell completion enabled in Homebrew, your terminal will automatically suggest and complete Astra CLI commands and options as you type them.
-
You can use curl
to install the Astra CLI on Linux, macOS, and Windows Subsystem for Linux (WSL).
-
Install the Astra CLI:
curl -Ls "https://dtsx.io/get-astra-cli" | bash
Result
_____ __ / _ \ _______/ |_____________ / /_\ \ / ___/\ __\_ __ \__ \ / | \___ \ | | | | \// __ \_ \____|__ /____ > |__| |__| (____ / \/ \/ \/ Installing Astra Cli 0.6 please wait... Checking prerequisites: [OK] - Ready to install. [OK] - unzip command is available [OK] - curl command is available Preparing directories: [OK] - Created /home/USERNAME/.astra/tmp [OK] - Created /home/USERNAME/.astra/cli [OK] - Created /home/USERNAME/.astra/scb Downloading archive: ######################################################################## 100.0% [OK] - File downloaded [OK] - Integrity of the archive checked Extracting and installation: [OK] - Extraction is successful [OK] - File moved to /home/USERNAME/.astra/cli [OK] - Installation cleaned up [OK] - astra added to /home/USERNAME/.bashrc [OK] - astra added to /home/USERNAME/.zshrc [OK] - Installation Successful Open A NEW TERMINAL and run: astra setup You can close this window.
The
~/.astra/cli
folder is added to thePATH
environment variable. See Installation file locations for more information. -
Open a new terminal or restart your existing terminal.
-
Confirm that the Astra CLI is installed:
astra --version
Result
0.6
The command returns the Astra CLI version that is installed.
macOS security alertsThe first time you run the
astra
command after installing or updating the Astra CLI on macOS, the operating system may display the following alert:“astra” Not Opened
.If you encounter this alert, then you must override your Mac security settings before you can run Astra CLI commands. See the Apple support documentation for more information.
The Astra CLI is available as a packaged Java application that you can use on any machine running a JVM.
To run the Astra CLI in a JVM, you must have Java 17+ installed. You can install Java by downloading and installing the latest Oracle JDK
-
Verify that Java is version 17 or higher:
java --version
-
Download the latest release of astra-cli
:
curl -L -o astra-cli-0.6.zip https://github.com/datastax/astra-cli/releases/download/0.6/astra-cli-0.6.zip
-
Unzip the archive:
unzip astra-cli-0.6.zip -d ./astra-cli-0.6 && cd astra-cli-0.6
-
Confirm that you can successfully run the Astra CLI:
java -jar astra-cli.jar --version
Result
0.6
The command returns the Astra CLI version that is installed.
You can use all options and suffixes on this command when running the JAR file. For example:
java -jar ./astra-cli.jar db list --token AstraCS:FZm...
The Astra CLI is available as an official Docker image that you can run in a container.
To install the Astra CLI using Docker, you must have Docker engine or Docker desktop installed.
-
Confirm that Docker is installed and running:
docker --version
Result
Docker version 27.1.1, build 6312585
-
Pull the latest Astra CLI Docker image:
docker pull datastax/astra-cli
Result
Using default tag: latest latest: Pulling from datastax/astra-cli 7890eb226106: Pull complete f4455e290156: Pull complete e6c3f5cd9c43: Pull complete 322cfd5270ff: Pull complete Digest: sha256:8dcba8115cbae7bcabfc579341611f30860239ee5edbca3938edea4542ca06fb Status: Downloaded newer image for datastax/astra-cli:latest docker.io/datastax/astra-cli:latest What's next: View a summary of image vulnerabilities and recommendations → docker scout quickview datastax/astra-cli
When you run
docker pull datastax/astra-cli
, Docker automatically pulls the latest version of the Docker image (datastax/astra-cli:latest
).To pull a specific version of the Docker image, run the following command:
docker pull datastax/astra-cli:TAG
Replace
TAG
with the version tag of the Docker image you want to pull. -
Confirm that you can successfully run the Astra CLI in a Docker container:
docker run -rm datastax/astra-cli --version
Result
0.6
The command returns the Astra CLI version that is installed.
-
(Optional) Run the Astra CLI with a configuration file:
docker run -rm -v CONFIG_FILE:/work/.astrarc datastax/astra-cli --version
Replace `CONFIG_FILE`with the path to your Astra CLI configuration file. For example:
docker run -rm -v ~/.astrarc:/work/.astrarc datastax/astra-cli --version
This command mounts the
~/.astrarc
file from your local machine to the/work/.astrarc
file in the Docker container. This lets you use your local configuration file when running the Astra CLI in a Docker container. -
(Optional) Create a shell alias for running the Astra CLI in a Docker container.
You can create a shell alias to eliminate the need to include the
docker run
command whenever you want to run the Astra CLI in a Docker container. For example, the following command creates an alias namedastra
:alias astra='docker run -rm -v ~/.astrarc:/work/.astrarc datastax/astra-cli'
You can run this command in your terminal to create a temporary alias for the current session, or you can add it to your shell configuration file so that the alias is available in every new terminal session.
After you add the alias, you can use it to run Astra CLI commands in a Docker container using the same syntax as the
astra
binary:astra --version
To set up a new configuration and run your first commands, see Get started with the Astra CLI.
Installation file locations
The Astra CLI and its configuration are installed in the following locations:
File location | Description |
---|---|
|
The Astra CLI installation directory. For curl-based installations, the For Homebrew-based installations, the
|
|
The Astra CLI configuration file. This file is not deleted when you update or re-install the Astra CLI. |
Update the Astra CLI
To update the Astra CLI, follow the procedure for the method you used to originally install the Astra CLI:
-
Homebrew
-
curl
-
Make sure Homebrew is up to date:
brew update
-
Update the Astra CLI:
brew upgrade datastax/astra-cli/astra-cli
Result
==> Upgrading datastax/astra-cli/astra-cli 0.5 -> 0.6 ==> Pouring astra-cli-0.6.arm64_sonoma.bottle.tar.gz ==> Caveats ------------------------ ENABLE AUTOCOMPLETION ------------------------- To enable Bash completion for Astra CLI (and other brew formulae when enable, add the following to your shell configuration file (e.g. ~/.zshrc): if [ -f /opt/homebrew/etc/bash_completion.d ]; then . /opt/homebrew/etc/bash_completion.d fi Once added, reload your shell or run: source /opt/homebrew/etc/bash_completion.d This will ensure the Bash completion script for Astra CLI is loaded. ------------------- SPECIAL COMMANDS ------------------- - CQLSH: You must have python 3.7+ but less than 3.12, cqlsh is still not compatible with 3.12, downgrade if needed - DSBULK: You must have java11+ installm the cli is pulling regular dsbulk ==> Summary 🍺 /opt/homebrew/Cellar/astra-cli/0.6: 4 files, 44.4MB ==> Running `brew cleanup astra-cli`... Removing: /opt/homebrew/Cellar/astra-cli/0.5... (4 files, 61.7MB) Removing: /Users/USERNAME/Library/Caches/Homebrew/astra-cli--0.5.arm64_sonoma.bottle.tar.gz... (24.4MB)
-
Confirm that the latest version of the Astra CLI is installed:
astra --version
Result
0.6
The command returns the Astra CLI version that is installed.
macOS security alertsThe first time you run the
astra
command after installing or updating the Astra CLI on macOS, the operating system may display the following alert:“astra” Not Opened
.If you encounter this alert, then you must override your Mac security settings before you can run Astra CLI commands. See the Apple support documentation for more information.
-
Update the Astra CLI:
curl -Ls "https://dtsx.io/get-astra-cli" | bash
-
Confirm that the latest version of the Astra CLI is installed:
astra --version
Result
0.6
Uninstall the Astra CLI
To uninstall the Astra CLI, follow the procedure for the method you used to originally install the Astra CLI:
-
Homebrew
-
curl
-
Uninstall the Astra CLI:
brew uninstall datastax/astra-cli/astra-cli
Result
Uninstalling /opt/homebrew/Cellar/astra-cli/0.6... (4 files, 61.7MB)
-
Delete the Astra CLI and its associated installation files:
rm -R ~/.astra
-
(Optional) Delete the Astra CLI configuration file:
rm ~/.astrarc
-
Delete the Astra CLI and its associated installation files:
rm -R ~/.astra
-
(Optional) Delete the Astra CLI configuration file:
rm ~/.astrarc
-
(Optional) Remove the Astra CLI from your shell configuration file (for example,
.zshrc
or.bashrc
).-
Open your shell configuration file in a text editor. For example:
nano ~/.zshrc
-
Remove any lines that reference the Astra CLI. For example:
#THIS MUST BE AT THE END OF THE FILE FOR ASTRA_CLI TO WORK!!! export ASTRADIR="/Users/USERNAME/.astra/cli" [[ -s "/Users/USERNAME/.astra/cli/astra-init.sh" ]] && source "/Users/USERNAME/.astra/cli/astra-init.sh"
-
Save and close the file.
-