Skip to content

Connect over SSH with VS Code

VS Code allows you to work on remote servers from your local machine.

Prerequisites

  1. Install VS Code by following the instructions.
  2. (Windows only) Install OpenSSH for Windows by following the instructions.
  3. Configure SSH so that you can access development nodes using proxy jumps by following these directions.
  4. (Optional) Set up SSH keys to connect to the HPCC without needing to enter a password. For Windows users, use the MobaXterm GUI instructions (or ensure that your private SSH key is saved to C:\Users\<Account_Name>\.ssh\id_rsa).

Warning

If you do not add the proxy jumps to the .ssh/config file on your local computer as described in step 3 above, you will not be able to access the HPCC from VS Code.

Connecting to the HPCC with VS Code

First, we need the Remote Development extension for VS Code, which can be obtained here

Screenshot of the VS Code Remote Development extension pack page

When the extension is installed, press F1, and select 'Remote-SSH: Connect to Host...' You may need to start typing this option to get it to appear. Screenshot of the VS Code command entry box with Remote-SSH: Connect to Host... highlighted

Then select intel18, k80, or any other development node. Screenshot of the VS Code SSH host selection box showing gateway, intel18 and k80

Never connect to a gateway node

If you have a Host gateway section in your .ssh/config file, gateway will be an option when connecting to a host using VS Code as shown in the screenshot above. Never choose this option. It will run a VS Code server on gateways node which are not meant for running user processes. This can lead to system slowdown and stop users from being able to login to the HPCC altogether.

You may be asked for the type of the remote platform, in which case, choose "Linux". Accept any other questions, and if you do not have SSH keys setup, you will be asked for your password.

Afterwards new VS Code window will pop up. When you are successfully connected, bottom left of the VS Code will show server information such as 'SSH: intel18'. Screenshot of the bottom left corner of the VS Code window showing SSH: intel18 in green for an affirmitive connection

Working on the HPCC with VS Code

Now that you are connected, you can run commands and codes from VS Code. When you are connected to the HPCC, all files created through VS Code will be saved to the HPCC, not on your local machine.

To test the ability to run remote code, let's create a Python file 'hello.py' with VS Code. Click 'New file' and create a file with the following content to the file: Screenshot of the VS Code welcome page showing the New file option

1
print('hello!')

Now, open a terminal from 'Terminal' menu from VS Code (or by pressing the key sequence CTRL+Shift+`) and run the code.

1
$ python hello.py

Once you have connected the server, click the Remote Explorer to see the list of servers. Click the icon to connect to host in a new window. Right click the name to see the option.

Screenshot of the VS Code Remote Explorer window showing the list of possible SSH targets: gateway, intel18, k80