Skip to content

Instantly share code, notes, and snippets.

@jtremback
Last active January 16, 2021 00:18
Show Gist options
  • Save jtremback/7a9e10fcef2b103639ca15b07720f00d to your computer and use it in GitHub Desktop.
Save jtremback/7a9e10fcef2b103639ca15b07720f00d to your computer and use it in GitHub Desktop.
Develop on a fast remote computer

VS Code has remote ssh functionality that is beyond what most people are used to when working with remote computers. It is good enough to make it feel like you are developing locally on a much faster computer. It is a very different experience from SSH in a terminal.

  • Full file explorer
  • Full terminal
  • All VS Code plugins are brought over automatically
  • VS Code plugins are also accelerated by the remote computer, for example linting in Rust
  • When the remote computer is on a cloud host such as AWS, dependencies are downloaded very quickly (they are probably hosted in the same data center)

How:

  1. Get a remote machine from a cloud host such as AWS. With AWS I've used instances in the c5 class. You can choose an amount of storage that is covered by the AWS free tier, but you will need to pay for a fast instance, usually between 8-60 cents per hour.
  2. Install the "Remote - SSH" VS Code plugin from Microsoft.
  3. Use the "Remote SSH: Add new SSH host..." command and put in the command you would use to connect to the instance on the terminal, for instance ssh -i ~/.ssh/us-west-2.pem [email protected]
  4. Use the "Remote SSH: Connect to host..." command to connect.
  5. VS Code will automatically copy everything over that it needs, and you will be able to use the file explorer and the terminal to move around inside the machine, pull down your code, and install anything else that needs to be installed.
  6. When you are done for the day, go to your cloud dashboard and stop the instance. On AWS, the filesystem is saved as a "Volume". This means everything will be as you left it when you start the instance again.
  7. Unfortunately, many cloud hosts change the IP address each time you start an instance. There are 3 ways to deal with this:
    • Just follow these steps again from the beginning (your ssh config file will get pretty crowded though after a few days)
    • Pay for a static IP (I think this is just a couple dollars a month)
    • Use a free dynamic dns service like https://www.duckdns.org/install.jsp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment