cdswctl Command Line Interface Client
- Logging in
- Creating an SSH endpoint
- Listing sessions that are starting or running
- Starting or stopping a session
Download and Configure the cdswctl
- You have an SSH public/private key pair for your local machine.
- You have Contributor permissions for an existing Cloudera Data Science project. Alternatively, create a new project you have access to.
- The Site Administrator has not disabled remote editing for Cloudera Data Science Workbench.
(Optional) Generate an SSH Public/Private Key
- Open Terminal.
- Run the following command and complete the fields:
ssh-keygen -t rsa -f ~/.ssh/id_rsaKeep the following guidelines in mind:
- Make sure that the SSH key you generate meets the requirements for the local IDE you want to use. For example, PyCharm requires the -m PEM option because PyCharm does not support modern (RFC 4716) OpenSSH keys.
- Provide a passphrase when you generate the key pair. Use this passphrase when prompted for the SSH key passphrase.
- Save the SSH key to the default ~/.ssh location.
Download cdswctl and Add an SSH Key
- Open the Cloudera Data Science Workbench web UI and go to for your user account.
- Download cdswctl client for your operating system.
- In the terminal, run cat ~/.ssh/id_rsa. If you used a different filename above when generating the key, use that filename instead. This command prints the key as a string.
- Copy the key. It should resemble the following: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCha2J5mW3i3BgtZ25/FOsxywpLVkx1RgmZunI
- In SSH public keys for session access, paste the key.
Initialize an SSH Connection to Cloudera Data Science Workbench
The following task describes how to establish an SSH endpoint for Cloudera Data Science Workbench. Creating an SSH endpoint is the first step to configuring a remote editor for Cloudera Data Science Workbench.
- Log in to Cloudera Data Science Workbench with the CLI client. Depending on your deployment, make sure you add http
or https to the URL as shown below:
cdswctl login -n <username> -u http(s)://cdsw.your_domain.comFor example, the following command logs the user sample_user into the https://cdsw.your_domain.com deployment:
cdswctl login -n sample_user -u https://cdsw.your_domain.com
- Create a local SSH endpoint to Cloudera Data Science Workbench. Run the following command:
cdswctl ssh-endpoint -p <username>/<project_name> [-c <CPU_cores>] [-m <memory_in_GB>] [-g <number_of_GPUs>]The command uses the following defaults for optional parameters:
For example, the following command starts a session for the logged-in user sample_user under the customerchurn project with .5 cores, .75 GB of memory, 0 GPUs, and the Python3 kernel:
- CPU cores: 1
- Memory: 1 GB
- GPUs: 0
cdswctl ssh-endpoint -p customerchurn -c 0.5 -m 0.75
To create an SSH endpoint in a project owned by another user or a team, for example finance, prepend the username to the project and separate them with a forward slash:
cdswctl ssh-endpoint -p finance/customerchurn -c 0.5 -m 0.75This command creates session in the project customerchurn that belongs to the team finance.Information for the SSH endpoint appears in the output:
... You can SSH to it using ssh -p <some_port> cdsw@localhost ...
- Open a new command prompt and run the outputted command from the previous step:
ssh -p <some_port> cdsw@localhostFor example:
ssh -p 9750 cdsw@localhostYou will be prompted for the passphrase for the SSH key you entered in the Cloudera Data Science web UI.Once you are connected to the endpoint, you are logged in as the cdsw user and can perform actions as though you are accessing the terminal through the Cloudera Data Science Workbench web UI.
- Test the connection.
If you run ls, the project files associated with the session you created are shown. If you run whoami, the command returns the cdsw user.