Running VSCode on AWS
Edit: Turns out that XQuartz is super laggy, and is not worth the time. If anyone figures out how to speed things up would love to know. This method will however work for opening GUI applications in general.
This might not be a big deal to most people, but if you play around with openCV this is quite useful. In some ways it’s an alternative to Jupyter Notebooks.
Fore the remainder of the tutorial, I’m going to assume that you know how to ssh into an AWS instance.
Local Machine Installations
This is your X11 client that will open up the graphical windows locally of your remote machine. Goto https://www.xquartz.org/ and install for your machine.
Remote EC2 Machine Installations
SSH into your EC2 machine and do the following
Use the following code to install VSCode on AWS:
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install code # or code-insiders
According to the answer posted here on stackexchange, you need to make sure that X11forwarding is enabled. So run cat /etc/ssh/sshd_config | grep X11Forwarding
and if it says no
in front of it, edit the file to say X11Forwarding yes
.
Now that the installation part is done, exit
back into your local machine and run ssh -X -i $PEMFILE ubuntu@xx.xx.xx.xx
. cd myFolder; code .
and this will open up VSCode.