akmadhwa.com

How to connect your EC2 instance to VSCode using SSH for remote development

Setting up your ssh file

  1. Make sure you know where you put .pem key as EC2 is not using password to get into the server.
  2. Locate your ssh folders. Usually it is located in your C:/Users/<yourUserName>/.ssh and put your .pem key in this folder. If you did not have.ssh folder please follow this guide.
  3. Open the config file located inside the ssh folders. if you dont have config file, create one.
1$ touch config
  1. Paste this line into your config file and save.
Host <Your EC2 IP>
  HostName <Your EC2 IP>
  User <your remote server username>
  IdentityFile c:\Users\<yourUserName>\.ssh\yourPemKeyName.pem

Setting up your VSCode

  1. Install Remote Development Extension.
  2. Click this icon at bottom left.

Remote SSH Icon

  1. After you click a bar will open. search for Connect Current window to host and click that option.
  2. You will see your Ip is in the list and click your ip to connect in the dropdown menu.
  3. After you successfully connect to your remote server, it may take some time for your server to setup.
  4. You can then open any folder or workspace on the remote machine using File > Open… or File > Open Workspace… just as you would locally!
  5. Make sure you check you extension because currently you are running vscode in your remote server. install all required extension to your remote server. You can check the status in your extension page in vscode.

References

#ec2   #ssh   #vscode  

Reply to this post by email ↪