Seamlessly linking VSCode and Google Compute Engine through Remote SSH
By linking VSCode and Google Compute Engine through Remote SSH, you're effectively getting the best of both worlds - the convenience and features of a local development environment with the power and capabilities of a cloud-based server.
By linking VSCode and Google Compute Engine through Remote SSH, you're effectively getting the best of both worlds - the convenience and features of a local development environment with the power and capabilities of a cloud-based server.
- Navigate to compute engine list of your Google Cloud project, click next to SSH and select View gcloud command. Paste to your terminal. After establishing a connection 2 files will be generated under
~./ssh
folder:$HOME/.ssh/google_compute_engine
for the private key and$HOME/.ssh/google_compute_engine.pub
for the public key - Create/modify
~/.ssh.config
where XX.XX.XX.XXX is the IP address of the compute engin.
Host XX.XX.XX.XXX
HostName XX.XX.XX.XXX
UseKeychain yes
AddKeysToAgent yes
IdentityFile ~/.ssh/google_compute_engine
User your_username
3. Open VScode and install SSH Remote extension. Here is the link if you need to know how to do it.
4. Command+Shit+P or (Control+Shift+P) to open up the VSCode Command Palette. Type in SSH and from a drop down select: Remote SSH: Connec to Host... (you can also add a new host if you'd like VSCode to memorize the IP.