Skip to content

Latest commit

 

History

History
75 lines (46 loc) · 4.3 KB

File metadata and controls

75 lines (46 loc) · 4.3 KB

VS Code Remote SSH Extension

We need to connect VS Code to a virtual machine in the cloud so you will only work on that machine during the bootcamp. A pretty useful Remote SSH Extension is available on the VS Code Marketplace.

  • Open VS Code > Open the command palette > Type Extensions: Install Extensions

VSCode extensions - Search - Remote

  • Install the extension

VS Code extensions - Remote - Details

That's the only extension you should install on your local machine, we will install additional VS Code extensions on your virtual machine.

Virtual Machine connection

  • Open VS Code > Open the command palette > Type Remote-SSH: Connect to Host...

vscode-connect-to-host

  • Click on Add a new host
  • Type ssh -i <path/to/your/private/key> <username>@<ip address>, for instance, my username is somedude, my private SSH key is located at ~/.ssh/de-bootcamp on my local computer, my VM has a public IP of 34.77.50.76: I'll type ssh -i ~/.ssh/de-bootcamp somedude@34.77.50.76

vscode-ssh-connection-command

  • When prompted to Select SSH configuration file to update, pick the one in your home directory, under the .ssh folder, ~/.ssh/config basically. Usually VS Code will pick automatically the best option, so their default should work.

vscode-add-host-ssh-config

  • You should get a pop-up on the bottom right notifying you the host has been added

vscode-host-added

  • Open again the command palette > Type Remote-SSH: Connect to Host... > Pick your VM IP address

vscode-add-new-host

  • The first time, VSCode might ask you for a security permission like below, say yes / continue.

vscode-remote-connection-confirm

  • Open again the command palette > Type Terminal: Create New Terminal (in active workspace) > You now have a Bash terminal in your virtual machine!

vscode-command-palette-new-terminal


vscode-terminal

  • Still on your local computer, lets create a more readable version of your machine to connect to!
code ~/.ssh/config

You should see something like the following:

Host <machine ip>
  HostName <machine ip>
  IdentityFile <file path for your ssh key>
  User <username>

You can now change Host to whatever you would like to see as the name of your connection or in terminal with ssh <Host>!

❗️ It is important that the Host alias does not contain any whitespaces ❗️

# For instance
Host "de-bootcamp-vm"
  HostName 34.77.50.76 # replace with your VM's public IP address
  IdentityFile <file path for your ssh key>
  User <username>

The setup of your local machine is over. All following commands will be run from within your 🚨 virtual machine🚨 terminal (via VS code for instance)