blog

Develop in the Cloud with Visual Studio Code

How to develop on remote cloud instances using Visual Studio Code.
2 min read /

Visual Studio Code can connect to a remote machine via SSH to provide an ergonomic development environment. The explorer allows browsing files remotely, and terminals allow running commands remotely. A particular convenience is that Code will automatically import credentials for you, to allow convenient interaction with e.g. GitHub repositories.

You will need to know the 👤user and 🏠host of the remote instance to which to connect. It will also need to be set up with a 🔑key or ✳️password that you can use to access it. If you are interested in developing on a GPU instance in particular, see the roundup of cloud service providers.

  1. Install Visual Studio Code
    Instructions are available at the Visual Studio Code website.
  2. Install the SSH extension
    Click the Extensions icon on the left. Type ssh into the search box. Find Remote - SSH from Microsoft (likely the first) and click the Install button next to it.
  3. Connect to your instance
    After installing the SSH extension, a new icon appears in the bottom left; click on it. A menu will appear at the top of the window. Select Connect to Host… then enter your 👤user and 🏠host into the textbox in the form user@host and hit Enter. A new window will open for the remote connection. If this is the first login for the instance, you may be prompted with “Host has fingerprint… Are you sure you want to continue?”; this is normal, click Continue. If you are using a ✳️password, you may be prompted to enter it.
  4. Setup your workspace
    On the left, click Open Folder and select a working directory to enable the file browser. From the menu, select Terminal > New Terminal to open a terminal, or use the keyboard shortcut Ctrl + `.

The screen recording below demonstrates the steps. For more information see the Visual Studio Code documentation.

Screen recording demonstrating how to connect to a remote instance via SSH in Visual Studio Code.