In this tutorial I'll 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, I assume you have:
- VS 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 VS code "Remote - SSH extension"
The extension is needed to connect to the host. Search for "remote-ssh":
And click "Install":
You will see a new Status bar item at the far left that indicates if you're running locally or remotely via SSH:
Step 2: Tell VS Code about your ssh key
In VS Code, press F1 to open the command palette and run "Remote-SSH: Open Configuration File..."
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:
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 VS Code by pressing F1 and typing "Remote-SSH: Connect to Host...":
VS Code will open a new window. There you'll see a notification that the "VS Code Server" is initializing on the SSH Host. If it's the first time you connect you might also have to confirm the authenticity of the remote host.
You might be also additionally asked to chose the platform of the cloud server while connecting:
The indicator status bar will show that you are connected to the Genesis Cloud instance:
From here on, you can code on your Genesis Cloud instance with VS Code just like you would if your source code was local!