Skip to main content

Connecting to workstations as remote backends for VS Code

Microsoft Visual Studio Code (VS Code) is a popular interactive development environment for a variety of programming languages, including Python. VS Code has gained popularity among scientists and software engineers because it simplifies the process of using remote machines, such as workstations, to interpret, compile, and test code.

Configure and verify SSH access

VS Code connections run over SSH and are secured by public key cryptography. To connect to a workstation with SSH, you must first create an SSH key and upload it to your account. Follow these instructions.

info

If you have issues connecting to a workstation with VS Code, first ensure you can connect to it with SSH in a terminal. We recommend using the SSH terminal application because it provides more information for debugging.

Configure VS Code to connect to a workstation

Follow the instructions below to configure VS Code to connect to a workstation, including as a backend for using VS Code to work with Jupyter notebooks:

  1. Download and install VS Code.

    1. If you are on Linux, MacOS, or WSL, verify that you have OpenSSL and SSH installed.
    2. If you are on Windows, install OpenSSL.
  2. In VS Code, install the "Remote Development" extension pack.

  3. In VS Code, open the Command Palette by typing F1 or Ctrl+Shift+P.

  4. In the Command Palette, type and select "Remote-SSH: Connect to Host..." and then select "Add New SSH Host..." This will open a prompt for an SSH connection command.

  5. Copy the SSH connection command for your workstation:

    1. Navigate to the workstations overview page.

    2. Locate the workstation that you would like to connect to.

    3. Click the workstation's "Connect" button. This will open a drop-down menu with the connection options for the workstation.

    4. Click the "VS Code" button in the drop-down menu. This will open a dialog box which contains instructions for connecting to the workstation.

    5. Click the second "Copy to clipboard" button to copy a command for connecting to the workstation.

      Example VS Code connection command
      ssh -o ProxyCommand="openssl s_client -quiet -connect {compute-cluster-id}.bench.deeporigin.io:2222 -servername {workstation-id}-{blueprint-id}.org-{org-id}" bench-user@{workstation-id} -i {ssh-private-key-file}

      Windows users may need to specify the full path to the OpenSSL executable, such as C:\Program Files\OpenSSL-Win64\bin\openssl.exe.

    6. Replace {ssh-private-key-file} in the copied connection command with the path to your SSH private key file.

    7. Optional: If you copied the shell command from this documentation page, replace the following variables:

      • org-id: Replace with the ID of your organization, such as acme-bio.
      • workstation-id: Replace with the ID of your workstation, such as exceptional-panda-g1i.
      • blueprint-id: Replace with the ID of the blueprint, such as python.
      • compute-cluster-id: Replace with the ID of your compute cluster, such as us-west-2.aws.
  6. In the prompt, paste the following command from the previous step, and press enter.

  7. Select a SSH configuration file to update, such as ~/.ssh/config (for Linux, MacOS, and WSL) or %HOMEPATH%\.ssh\config (for Windows).

  8. Click "Connect" in the dialog that appears in the bottom right of the window.

Use VS Code to connect to a workstation that has been previously configured

After configuring VS Code (see previous section), follow these steps to connect VS Code to a workstation.

  1. Open VS Code.
  2. In VS Code, open the Command Palette by typing F1 or Ctrl+Shift+P.
  3. In the Command Palette, type and select "Remote-SSH: Connect to Host..." and then select the workstation that you would like to connect to. This will open a new VS Code workspace for the workstation.
  4. If prompted, select the operating system of the workstation. Currently, all workstations are based on Debian Linux.

Enhancing the VS Code connection experience

Optionally, you can make it easier to connect to workstations with VS Code by following the steps below:

  1. Follow the instructions below to configure your SSH client to connect to Deep Origin workstations. These instructions only have to be done once for each host machine you wish to connect from.
  2. Add your SSH key to your SSH agent. This will allow your SSH client to automatically use your key to connect to workstations.

After performing these steps, run the command below to connect to a workstation, replacing the following variables:

  • org-id: Replace with the ID of your organization, such as acme-bio.
  • workstation-id: Replace with the ID of your workstation, such as exceptional-panda-g1i.
  • blueprint-id: Replace with the ID of the blueprint, such as python.
  • compute-cluster-id: Replace with the ID of your compute cluster, such as us-west-2.aws.
Example SSH connection command
ssh {workstation-id}-{blueprint-id}.org-{org-id}.{compute-cluster-id}.bench.deeporigin.io

Further help

For additional help, see the documentation for the VS Code remote SSH extension.