Search code examples
amazon-web-servicesamazon-ec2

Uploading file to AWS from local machine


How to use scp command to upload file to aws server

  • I have .pem file in /Downloads in local machine
  • I am trying to copy file to /images folder in AWS server

    What command can i use ?

Thanks,


Solution

  • You can use plain scp:

    scp -i ~/Downloads/file.pem local_image_file user@ec2_elastic_ip:/home/user/images/
    

    You need to put an Elastic IP to the EC2 instance, open port 22 to your local machine IP in the EC2 instance security group, and use the right user (it can be ec2-user, admin or ubuntu (look at the AMI documentation)).