Connecting to EC2 Instance from VSCode
Connecting via SSH from Visual Studio Code to an EC2 Instance is a quick alternative to using Cloud9.
1. Download Visual Studio Code and the Remote - SSH extension
You can download VS Code here: Download VSCode
Once downloaded, install the Remote - SSH extension.
2. After installation, click the icon in the bottom left corner to open a dialog box.
3. Click on Connect to Host.
4. Click on Add New SSH Host.
7. In the SSH configuration block, replace the placeholder with the correct IPv4 address of the EC2 Instance and the path to your Key Pair on your machine.
Host deploy-instance-remote
HostName 3.106.228.72
User ubuntu
IdentityFile "C:\Users\ADMIN\Downloads\devsecops-kp.pem"
8. Click the SSH icon in the bottom left corner to start the Connect process.
9. When a new window appears, select Continue.
10. Click on Linux and wait a moment for the VSCode Server to be installed on the EC2 Instance.
11. Select Open Folder and click OK.
12. This is the interface after connecting.