Installing Cloudbreak CLI
The Cloudbreak Command Line Interface (CLI) is a tool to help you manage your Cloudbreak cluster instances. This tool can be used to interact with Cloudbreak for automating cluster creation, management, monitoring, and termination.
The CLI is available for Linux, Mac OS X, and Windows.
Install the CLI
After you have launched Cloudbreak, the CLI is available for download from that Cloudbreak instance.
- Browse to your Cloudbreak instance and log in to the Cloudbreak web UI.
- Select Download CLI from the navigation pane.
- Select your operating system. The CLI is available for Linux, Mac OS X, and Windows.
- Download the selected bundle to your local machine.
- Extract the bundle.
- You can optionally add
cbto your system path.
Run the executable to verify the CLI:
Configure the CLI
Once you have installed the CLI, you need to configure the CLI to work with Cloudbreak.
cb configurecommand to set up the CLI configuration file. The configuration options are:
- --server server address [$CB_SERVER_ADDRESS]
- --username user name (e-mail address) [$CB_USER_NAME]
- --password password [$CB_PASSWORD]
The password configuration is optional. If you do not provide the password, no password is stored in the CLI configuration file. Therefore, you will need to provide the password with each command you execute or via an environment variable.
cb configure --server https://ec2-11-111-111-11.compute-1.amazonaws.com --username email@example.com
The CLI configuration file will be saved at
~/.cb/config. The content will look similar to the following:
default: username: firstname.lastname@example.org server: https://ec2-11-111-111-11.compute-1.amazonaws.com
Run any command to verify that you can connect to the Cloudbreak instance via CLI. For example:
cb cluster list
The CLI can look for configuration options from different locations. You can optionally pass the configuration options on each command or from environment variables. The following order is used for the CLI to look for configuration options: Command line, Environment variables and the Configuration file.
Add multiple configurations
If you are using multiple profiles for multiple environments, you can configure them using the
cb configure command and passing the name of your environment-specific profile file using the
--profile parameter. After running the command, the configuration will be added as a new entry to the
config file. For example, running the following command
cb configure --server https://220.127.116.11 --username email@example.com --profile staging will add the "staging" entry:
default: username: firstname.lastname@example.org server: https://18.104.22.168 staging: username: email@example.com server: https://22.214.171.124
#cb configure --server https://126.96.36.199 --username firstname.lastname@example.org --profile staging INFO: [writeConfigToFile] dir already exists: /Users/rkovacs/.cb INFO: [writeConfigToFile] writing credentials to file: /Users/rkovacs/.cb/config # cat /Users/rkovacs/.cb/config default: username: email@example.com server: https://188.8.131.52 output: table staging: username: firstname.lastname@example.org server: https://184.108.40.206
Configure default output
By default, JSON format is used in command output. For example, if you run
cb list-clusters without specifying output type, the output will be JSON. If you would like to change default output, add it to the config file. For example:
default: username: email@example.com server: https://220.127.116.11 output: table
Configure CLI autocomplete
The CLI includes an autocomplete option. Before you can use this option, you must download and source one of the following files:
- For bash: bash_autocomplete
- For zsh: zsh_autocomplete
These two files are located in https://github.com/hortonworks/cb-cli/tree/rc-2.7/autocomplete
Once you've sourced the file, type the CLI commands as usual and use the Tab key to access the autocomplete feature.