Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code Remote-SSH to AWS Instance

Is it possible to connect SSH within VS Code (for MacOS) to my AWS instance?

I would like to use it the same way I do with docker containers. Modify my code inside the AWS instance and use the same compute power.

Thanks

like image 223
Pablo Ruiz Ruiz Avatar asked Dec 23 '22 22:12

Pablo Ruiz Ruiz


1 Answers

HOW TO CONNECT TO AWS INSTANCE (EC2)

  1. Open Visual Studio Code and install extension - 'Remote - SSH'
  2. After installation click the green link icon bottom left of the VSC to 'Open a remote window'
  3. Select 'Remote-SSH: Connection to host...
  4. Add new SSH host
  5. Type ubuntu@hostname_or_ip
  6. Select the '/root/.shh/config'
  7. Edit the config file

See my example

#Read more about SSH config files: https://linux.die.net/man/5/ssh_config

Host <enter hostname>
    HostName <enter hostname>
    User ubuntu
    IdentityFile ~/.ssh/mypemfile.pem 
  1. Save and connect by clicking the link to 'open a remote window' and select your saved configuration.
like image 132
medotvu Avatar answered Jan 08 '23 17:01

medotvu