DEV Community

Cover image for How to Integrate an AWS EC2 Instance with VS Code using Remote SSH
Ryoichi Homma
Ryoichi Homma

Posted on • Edited on

1

How to Integrate an AWS EC2 Instance with VS Code using Remote SSH

Developing directly on Amazon EC2 instance can improve workflow efficiency and eliminate the need for constant file transfers. This article will explain how to integrate an EC2 instance with VS Code using the Remote - SSH extension.

Prerequisites

  • AWS EC2 instance running
  • SSH access to your EC2 instance
  • VS Code installed on your local machine

1. Install VS Code Extension

Remote SSH

2. Connect to EC2 via SSH in VS Code

  • Press shift + ctrl + P at the same time, and select Remote SSH: Connect to Host.
    Step1

  • Click + Add New SSH Host..., type the following and press enter.

ec2-user@XX.XX.XX.XX 
Enter fullscreen mode Exit fullscreen mode

Step2

  • Select the top one, .ssh\config to open the config file and add the following:
Host ec2-server
  HostName XX.XX.XX.XX
  User ec2-user
  IdentityFile ~/ec2
  ForwardAgent yes
Enter fullscreen mode Exit fullscreen mode
  • Open the Remote Explore tab on the left sidebar.
  • Under SSH Targets, locate ec2-server.
  • Click the connect arrow (→).
  • Select the correct OS for the remote machine.
  • If SSH: ec2-server appears at the bottom left and the terminal shows something like:
[ec2-user@ip-xx-xx-xx-xx ~]$
Enter fullscreen mode Exit fullscreen mode

You have successfully connected to the remote EC2 instance.

3. Transfer Project Folder

  • Simply drag and drop your project folder to the root directory of the EC2 instance. Root directory

By following these steps, you should be able to integrate the EC2 instance with VS Code. This setup improves development efficiency and allows seamless remote coding in a cloud environment.

Heroku

Deliver your unique apps, your own way.

Heroku tackles the toil — patching and upgrading, 24/7 ops and security, build systems, failovers, and more. Stay focused on building great data-driven applications.

Learn More

Top comments (0)

Image of PulumiUP 2025

From Cloud to Platforms: What Top Engineers Are Doing Differently

Hear insights from industry leaders about the current state and future of cloud and IaC, platform engineering, and security.

Save Your Spot

👋 Kindness is contagious

Dive into this thoughtful article, cherished within the supportive DEV Community. Coders of every background are encouraged to share and grow our collective expertise.

A genuine "thank you" can brighten someone’s day—drop your appreciation in the comments below!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found value here? A quick thank you to the author makes a big difference.

Okay