Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Last active August 3, 2022 23:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Shelob9/0e032880634d75eab0a24f9fad9ad3ea to your computer and use it in GitHub Desktop.
Setting up vsCode remote on AWS ec2 instance and connecting via ssh to desktop vsCode worked out pretty well, doing this. https://twitter.com/Josh412/status/1554600427261394948 https://www.sitepoint.com/vs-code-remote-development-amazon-ec2/

Go to ec2 console

  • "Launch Instance"
  • Name:
  • Ami: Ubuntu in quickstart
    • Defaults are fine
  • Instance type:
    • t2.micro is free tier
  • Key pair:
    • Can create one (make sure to download and save)
      • Save to .ssh config or something
      • C:\Users\username.ssh\vscode-test-1.pem
    • Easier on second build to reuse existing keypair from first buil
  • Network settings:
    • Defaults
    • Firewall
      • Use existing is good
      • Create new "Create security group"
        • "Allow SSH traffic from" true, other allows false
        • Later may want to enable https for https
        • Do not enable http, don't worry about accessing dev servers on localhost.
        • For IP, "My IP" is best
  • Coinfigure storage
    • 24gb defaults
    • root value
  • Adavnced
    • ignore
  • Launch instance
    • Wait to launch
  • View all instances
  • Copy public IP of instance "Public IPv4 address"

Links

Steps

Host VS vs-code-test
HostName <IP copied from console>
User ubuntu
IdentityFile <PATH TO IDENTITY FILE> 

Example:

Host vscode-test-1
   HostName 3.33.150.70
   User ubuntu
   IdentityFile C:\Users\username\.ssh\vscode-test-1.pem
  • Save
  • Remote-SSH: Connect Current Window To Remote Host
  • Choose host
  • First time it will
    • ask you to confirm ssh fingerprint
    • Then will install and configure vscode server

If the path for key file is wrong, that will generate an error without connecting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment