Visual Studio Code extension : Remote SSH
Out of many extensions for Visual Studio Code, I've been enjoying the Remote SSH package for various reasons. Let's see what this is about.
What is it?
As its name suggests, it is an extension that lets you remotely SSH into another machine for development using Visual Studio Code. That sounds simple enough!
If you read the description a bit more, you will realize it touches on a few cool points.
Using your remote machine's OS
As you are using an SSH connection to access another machine - which could be a server in the cloud (like an EC2 instance) or it could be your desktop sitting behind your laptop - you can fully take advantage of that machine's OS and software.
For example, I use my Windows laptop to remote SSH into my Linux desktop and I can fully utilize all the features of Linux in my Visual Studio Code. This includes things that Windows Subsystem for Linux (WSL) does not fully support - for example, things like Docker containers are much easier to work in native Linux compared to WSL without any performance overhead.
Run your apps anywhere
A further extension to the point above is that when you are developing through SSH on Visual Studio Code, not only do you get to use the remote machine's OS, but you get to use all the software installed on it.
This means I can develop node.js or python (or whatever software) applications on a laptop that has nothing but Visual Studio Code installed on it. This allows my host machine to be free of the development software and still allows me to develop whatever I want to. I can take any laptop I own and turn it into a development machine without the need for it to have all sorts of different development software installed.
This also brings up another point...
Seamlessly develop in multiple computers
Rather than having to set up multiple machines with development software and then sync code using git or other file-syncing software, you can simply download Visual Studio Code, connect to your remote development environment and continue where you left off from another computer.
You may also ask, how do you test your application running on the remote machine? The extension provides a feature to forward ports from the remote machine to your local machine. For example, you can run a server running on port 3000 on your machine and set up port forwarding on 3000, such that you can access that server from your local browser using http://localhost:3000.
In fact when you run a server, quite often Visual Studio Code will detect it and automatically set up a port forwarding for you.
Summary
To summarize this extension is quite useful in allowing you to leverage Linux OS remotely and seamlessly integrate it with whatever host system you are using. Besides giving you a much more visual experience compared to Vim or Emacs, it also provides cool features like port forwarding and allows you to take advantage of any other Visual Studio Code extensions you are using as well.
A little tip for SSH setup - use a public key for authentication. This allows you to access your machine without the need to type a password every time. Happy coding!
Subscribe to my newsletter
Read articles from Icecreamsoft directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Icecreamsoft
Icecreamsoft
Developer, working on projects during free time. Decided to make a blog to help motivate self and also document ideas and learnings for future use. Hopefully it is also useful for someone else as well!