Connect over SSH with VS Code
VS Code allows you to work on remote servers from your local machine.
Prerequisites
- Install VS Code by following the instructions.
- (Windows only) Install OpenSSH for Windows by following the instructions.
- Configure SSH so that you can access development nodes using proxy jumps by following these directions.
- (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
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.
Then select intel18, k80, or any other development node.
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'.
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:
1 |
|
Now, open a terminal from 'Terminal' menu from VS Code (or by pressing the key sequence CTRL+Shift+`) and run the code.
1 |
|
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.