We raised a Series A! Read a post from our CEO, Zhen Lu: 1M devs and the cloud we're building next.

Connect VSCode to Your Runpod Instance (Quick SSH Guide)

Want to code remotely like it’s local? This guide walks you through connecting VSCode to your Runpod instance using SSH for fast, seamless GPU development.

Connect VSCode to Your Runpod Instance (Quick SSH Guide)

While working in a terminal window is sometimes good enough, it's much nicer to work within your IDE if you are doing interactive development. Fortunately, you can connect your VSCode IDE to your Runpod instance via SSH. This will allow you to edit files and code on your remote instance directly from VSCode.

Pre-requisites:

1) A generated SSH key pair that you've configured in your settings (see this blog post)

2) A running Runpod instance with exposed TCP connection (You have to deploy the pod after you set up your SSH key!)

To keep this blog post short, I am going to assume that you already have done the pre-requisites 1 and 2. To make sure that this was done correctly, open your pod dashboard and click on the "Connect" button.

Runpod connection options with a Connect to Jupyter Lab button and SSH commands, including SSH over exposed TCP

You should see the "To connect via SSH over exposed TCP" section (Make sure that you see a number IP and NOT something like blah@ssh.runpod.io !). Go ahead and run the last SSH command in a terminal window to confirm that you are able to connect via SSH. Make sure that the path after "-i" points to the path where you saved/generated your public key.

If you are able to SSH to your instance with this, then you have met the pre-reqs and should be able to connect via VSCode in a few short steps! If not, then check your key pair for extra spaces and irregularities. If it's asking for a password, this is generally a problem with your key pair.

First, open VSCode and make sure you have the following extension installed:

VS Code Extensions Marketplace showing the Microsoft Remote Development extension pack

Once you've installed this extension, you should be able to open the command palette by hitting "ctrl+shift+p". You should be able to then choose the "Remote-SSH: Connect to Host..." option.

VS Code command palette with Remote-SSH: Connect to Host highlighted

This should present you with some new options. Choose "Add new SSH Host".

VS Code prompt to select a configured SSH host with the Add New SSH Host option

This should bring up a new prompt for you to put in an SSH command. Put in the SSH command that you confirmed works earlier and then hit enter.

VS Code Enter SSH Connection Command input showing an example SSH command placeholder
VS Code SSH connection command entered with root user, custom port, and private key path

It will prompt you to choose a SSH configuration file. You can choose whichever you want. Choosing the default is safe if you don't know what this is.

VS Code prompt to select an SSH configuration file to update

Now that your host is added, go back to the command palette menu "ctrl+shift+p" and choose the "Remote-SSH: Connect to Host..." option again. This time, you should have a host in your options:

VS Code SSH host picker listing the pod IP address 209.137.198.23

Go ahead and select it and it should connect to your pod.

VS Code welcome screen connected over SSH, with the remote host shown in the status bar

You can verify that you are connected by looking for the IP address in green in the bottom left corner. You can now develop remotely in your IDE! Enjoy!

Author profile: Zhen Lu

Related articles

View All
What's new in Runpod Serverless: Faster cold starts, batch inference, and no-Docker deploys

What's new in Runpod Serverless: Faster cold starts, batch inference, and no-Docker deploys

Whether you're already running production endpoints on Runpod or you're sizing us up for the first time, here's a plain-language tour of what Runpod Serverless does today, why it's faster and cheaper than it was six months ago, and how to deploy your first endpoint in minutes.

All

Build what’s next.

Build, train, and scale AI workloads on Runpod with cloud GPUs, Serverless, and Clusters.