Configure CLI for use with workspaces
When using multiple workspaces, you can switch between them in the CLI in order to access workspace-specific resources.
There are two options to access a workspace via the CLI:
Option | When to use |
---|---|
Configure CLI to use a workspace permanently | This method is useful if you would like to use one workspace permanently. |
Provide the –-workspace flag with each command |
This method is useful if you would like to switch between multiple workspaces. |
Configure CLI to use a workspace permanently
To configure the CLI to use a specific workspace permanently, use:
cb configure --username [$VALUE] --password [$VALUE] --server [$VALUE] --workspace [$VALUE]
For example:
cb configure --username test@cloudera.com --password MyPassword123! --server http://191.118.89.112 --workspace marketing
This will permanently save the configuration in ~/.cb/config so you don’t need to provide the
–workspace
flag when running CLI commands. Here is an example config file:
default:
username: test@hcloudera.com
password: MyPassword123!
server: http://191.118.89.112
workspace: marketing
Provide the –workspace
flag with each CLI command
If you do not want to permanently configure a specific workspace in the Profile, you
can simply provide the –workspace <value>
flag with each CLI command. For
example, the following command returns all clusters that are part of the workspace called
"marketing":
cb cluster list --workspace marketing