How to transfer file from local system to AWS EC2...?

Prem ChoudharyPrem Choudhary
1 min read

We cannot able to connect local system to AWS EC2 instance just because our key is visible, we just have to change the permission mode of that key.

Here the solution:

  1. Open your terminal.

  2. Connect your bastion server with local system by ssh command.
    ssh -i /path/to/your-private-key.pem ec2-user@<EC2-IP>

  3. Open WSL(Windows Subsystem for Linux).

  4. Run: chmod 400 /mnt/c/path/to/your-pem-key.pem

  5. Run: ls -l /mnt/c/path/to/your-pem-key.pem

  6. Run: scp -i ~/your-private-key.pem ~/your-pem-key.pem ubuntu@<EC2-IP>.compute-1.amazonaws.com:/home/ubuntu/

    Thank you❤️

0
Subscribe to my newsletter

Read articles from Prem Choudhary directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Prem Choudhary
Prem Choudhary

DEVOPS ENGINEER || AWS || JAVA || PYTHON || SPRING BOOT || SPRING SECURITY || REACT.JS || MONGO DB || MYSQL