Setup VS Code for remote development
Well in order to setup a remote environment, you need a DigitalOcean account, you can use my referral code below to get $100 for 60 days just to try these things out π
After you're done creating an account, let's move to the next step
Creating a Droplet
On the left menu, click on the Droplet button

Create a new droplet by clicking on the
"Create Droplet"buton
Choose a distro of your flavour (I choose Ubuntu for ease of use) and select your desired specs

Select the datacenter region closest to you for better latency

For Authentication, choose SSH keys and click on the "New SSH Key" button below

Use the command
ssh-keygento generate an SSH key, and the file would be stored under~/.ssh/id_rsa.pub(for Mac and Linux) andC:\<user_name>\.ssh\id_rsa.pub(for Windows)
NOTE: The command ssh-keygen might not work on Windows CMD or Powershell, use Git Bash
Finally, click on
"Create Droplet"at the bottom and wait for a few minutes for it to spin up
Connecting to droplet via SSH
Copy the IP address
Go to your terminal, and type π
ssh root@<IP_ADDRESS>- Example π
ssh [email protected]
- Example π
Once inside the Droplet, create a new
sudouserCreate a new user π
adduser vscodeAdd it to
sudogroup πusermod -aG sudo vscode
Login as the user π
su - vscode
Create a new
sshdirectory πmkdir ~/.sshCreate a new file inside it π
touch ~/.ssh/authorized_keysCopy the contents of
id_rsa.pubfile, present on your local PC and paste it inside theauthorized_keysfile you created on your DropletTo paste the contents into
authorized_keysfile, you can use any cli based text editor,nanoexample below π
Press Ctrl-X, then Y and then Enter to save the file
[OPTIONAL] Type
chmod 600 ~/.ssh/authorized_keysto make sure other users don't access this file
Press Ctrl-D twice to logout from the Droplet and test ssh connection of this new user
vscodeType
ssh vscode@<IP_ADDRESS>to connect to your Droplet, but now as the uservscodeinstead ofroot
VS Code Remote development
Add the Remote - SSH extension to VS Code

Go to VS Code, click on the bottom left button

Choose Connect to host

Type in
ssh vscode@<IP_ADDRESS>Choose your
sshfolderThen you can connect to your Droplet for remote development

A new window will open, with remote connection to your Drop

Now, you can make use of the VMs resources to build applications on the cloud
