This article will help you connect your local VS Code to Bren's computational servers.
Step 1:
If you have not installed VS Code on your machine yet, you can download it here.
Step 2:
Launch VS Code. It should look like this:
Step 3:
Navigate to your extensions, which is highlighted with a red box.
VS Code extensions are add-ons that provide new features and abilities to your VS Code environment. Some common extensions we recommend if relevant are:
- Jupyter
- Python and Python Debugger
- R
- Quarto
- DuckDB
- Remote - SSH (we will be using this extension!)
To continue to the next step, please ensure that the "Remote - SSH" extension by Microsoft is installed then restart your VS Code session.
Step 4:
Open up your Command Palette. You can use the following keyboard shortcuts:
- Mac: Command+Shift+P
- Windows: Ctrl+Shift+P
Alternatively, you can select "View" in the top of your screen when you're in VS code then select "Command Palette.
Your Command Palette in VS Code is where all of your VS Code commands are stored. It should look something like this:
Step 5:
Now, you'll need to add a new SSH host for any server you'd like to work on. You do this by typing the following:
Remote-SSH: Add New SSH Host
in your Command Palette then pressing enter. It should look like this:
It'll prompt you to set up your SSH Connection. You'll type in:
ssh [username]@[server-url]
For the purposes of this example, we are connecting to an account named "katherine" on the quetzal.bren.ucsb.edu server.
If you are in MEDS, you would be using workbench-1.bren.ucsb.edu or workbench-2.bren.ucsb.edu as your server url. Example below:
Step 6:
Once you entered your new SSH Connection, it'll ask you to specify a configuration file to update. The location of the config file is unique to your computer. Just select the first one that pops up for you.
I save my config file in my laptop's home directory in a hidden directory called ".ssh". Example:
Once you select a file, you'll get a notification that a new host is added. From here, you can select "Connect"
It'll open up another VS Code window for you and ask you for your server account password. Once you type in your password, it'll enable the SSH connection. You'll know you're connected to the server if your session has the connection highlighted by the red box in the following image:
Step 7:
Once you've added that SSH host for the first time, you can easily access that SSH connection by opening up your Command Palette again and typing:
Remote-SSH: Connect to Host
Your SSH connections should be saved and you can just select the server want to use.
Final
Hope this is helpful! If you have any questions, feel free to contact us at compute@bren.ucsb.edu.