How to Connect EC2 Instance with VSCode Directy using pem file in SFTP

vscode remote-ssh raspberry pi
vscode sftp
sshfs vscode
vscode remote-ssh ec2
vscode sync with remote server
vscode launch.json ssh
vscode-remote container ssh
vscode server

I'm trying to connect EC2 Instance directly from VS Code using SFTP. I can able to connect other ftp service using [password] type, but for EC2 instance i'm having only .pem file. Expecting something like this but using public key .pem file

{
"protocol": "sftp",
"host": "localhost",
"port": 22,
"username": "username",
"remotePath": "/"
}

Try this config.json on VScode

{
    "remotePath": "/",
    "host": "<IP-OR_EC2-INSTANCE-HOST-NAME>", 
    "username": "USERNAME",
    "password": "PASSWORD",
    "port": 22,
    "secure": true,
    "protocol": "sftp",
    "uploadOnSave": true, 
    "passive": false,
    "debug": true,
    "privateKeyPath": "<PATH-TO-PEM-FILE>",
    "passphrase": null,
    "ignore": [
       ------
    ],
    "generatedFiles": {
        "uploadOnSave": false,
        "extensionsToInclude": [],
        "path": ""
    }
}

Remote Development with Visual Studio Code on Amazon EC2 , You'll have a terminal and access to the AWS EC2 instance via SSH. One part is the private key that resides in an extensionless or .pem file that has many lines. To create a shortcut to other folders on your server, use the Add Folder to  Save it as an extensionless file called config in the C:\Users\Example\.ssh\ folder, same as above. To explain: Host (aws-ec2) is just a name that will appear in VS Code (as window title and connection indicator in the lower-left corner). HostName is the server’s host or IP. User is the Ubuntu username. IdentityFile is the path to the private


If you want to connect your VS Code to AWS EC2, use the Remote Development extension pack and use it for SSH. The .pem file and the standard SSH config file will reside at:

C:\Users\YourName\.ssh\

Host aws-ec2
     HostName example.dev
     User example
     IdentityFile c:\Users\YourName\.ssh\aws-example-user.pem

I wrote an article detailing the whole VS Code to AWS EC2 setup.

pem file support · Issue #173 · microsoft/vscode-remote-release , Hi, at my company, we are usually using pem file to connect to our instances like: ssh -i '/path/to/file.pem' ubuntu@hostname I didn't find any  You can connect to an instance using the EC2 Instance Connect CLI by providing only the instance ID, while the Instance Connect CLI performs the following three actions in one call: it generates a one-time-use SSH public key, pushes the key to the instance where it remains for 60 seconds, and connects the user to the instance.


Open the sftp.json config file by pressing ctrl + Shift+ P then type SFTP:Config and edit "host", "privateKeyPath" then save the json file

{
"name": "GIVE ANY NAME",
"host": "ec2-.........compute.amazonaws.com",
"protocol": "sftp",
"port": 22,
"username": "ec2-user",
"privateKeyPath": "SPECIFY YOUR PATH/FILENAME.pem",
"remotePath": "/",
"uploadOnSave": true
}

Developing on Remote Machines using SSH and Visual Studio Code, You might have multiple AWS accounts that you want to access from the Toolkit for VS Code. Multiple accounts can be useful, for example, to provide developers​  To connect to an EC2 instance in an Amazon VPC, you can tunnel through a NAT instance. For details, see a guide to connecting to an SFTP server which can be accessed via another server only. Connecting using AWS SSM (Session Manager)


In my mac OS Catalina 10.15 with Visual Studio 1.39.0 works this, usign a Key Pem:

Note: privateKeyPath, is the path of the key.pem in your computer.

{
    "name": "id0000533-test",
    "protocol": "sftp",
    "host": "ec2-12-123-123-123.eu-west-1.compute.amazonaws.com",
    "remotePath": "/var/www/laravel",
    "privateKeyPath": "../keypem/id0000533-test.pem",
    "username": "admin",
    "port": 22,
    "secure": true,
    "uploadOnSave": true,
    "passive": false,
    "debug": true,
    "ignore": [
        "\\.vscode",
        "\\.git",
        "\\.DS_Store"
    ],
    "generatedFiles": {
        "uploadOnSave": true,
        "extensionsToInclude": [],
        "path": "./"
    }
}

Remote SSH access with Visual Studio Code, The toolkit gives me all the same advantages of storing my private key and takes care of converting the private key from its native PEM format to  You can connect to a AWS ec-2 instance using the following commands. chmod 400 mykey.pem ssh -i mykey.pem username@your-ip by default the machine name usually be like ubuntu since usually ubuntu machine is used as a server so the following command will work in that case. ssh -i mykey.pem ubuntu@your-ip


Connecting to AWS through the AWS Toolkit for Visual Studio Code , I use WinSCP instead of FileZilla to transfer files to/from my EC2 instance. transferred the *.pem (ssh private key) file, you should not need to use [Set1] anymore. Now simply launch FileZilla and connect to your server using SFTP using SSH2 If the new file is shown in the list of Keyfiles, then continue to the next step. This is the situation. I made a key pair pem file called "test.pem" and i downloaded to my PC. made a new instance with this pem file. ok. Now i'm in a different pc. and i don't have this pem f


Connecting to Amazon EC2 Instances from the AWS Toolkit for , I recently started using EC2 for my deep-learning workloads and I was and easily navigating between files, getting to view the folder a VSCode instance up and running with absolutely no setup required on the instance!!! Locate the private key (.pem file) for the key pair that you specified when you launched the instance. Convert the .pem file to a .ppk file for use with PuTTY. For more information, follow the steps in the next section.


Accessing Amazon EC2 in Filezilla SFTP, To connect to your instance using SSH. In a terminal window, use the ssh command to connect to the instance. You specify the path and file name of the private key (.pem), the user name for your instance, and the public DNS name or IPv6 address for your instance.