In this tutorial, we will explain how to create and connect to a Genesis Cloud instance using the Visual Studio Code Remote - SSH extension in 3 simple steps.
This will enable you to work on a remote machine with VS Code just like if your source code was local.
Going forward, we assume you have:
Visual Studio Code installed
OpenSSH compatible SSH client (PuTTY is not supported)
You have created a Genesis Cloud instance and have the ssh-key required to connect to it.
Step 1: Install Visual Studio code "Remote - SSH" extension
The extension is needed to connect to the host. Search for "remote-ssh".
The Visual Studio Code Extensions tab
Then click "Install".
The Remote - SSH extension
You will see a new Status bar item at the far left that indicates if you are running locally or remotely via SSH.
The status bar item
Step 2: Tell Visual Studio Code about your SSH Key
In Visual Studio Code, press F1 to open the command palette and run "Remote-SSH: Open Configuration File...".
The VS Code command palette
And select your SSH config file and add a host entry block for your Genesis Cloud instance.
Host arbitraty-nickname-of-host-here User your-user-name-on-host HostName public-IPv4-goes-here IdentityFile ~/.ssh/id_rsa |
For Genesis Cloud Ubuntu-instances your default username is "ubuntu". A complete example could look like.
The config file allows to set your username
If you want, you can later add more hosts by simply repeating the Host block for a different remote server.
Step 3: Connect to your instance
Now you can simply connect to your instance via Visual Studio Code by pressing F1 and typing "Remote-SSH: Connect to Host...".
The VS Code command line now provides the option to connect to a host of your choice
VS Code will open a new window. There you will see a notification that the "VS Code Server" is initializing on the SSH Host. If it is the first time you connect you might also have to confirm the authenticity of the remote host.
You might be also additionally asked to choose the platform of the cloud server while connecting.
VS Code prompts you to select the host platform
The indicator status bar will show that you are connected to the Genesis Cloud instance.
The indicator status bar