Search code examples
macosamazon-web-servicesamazon-ec2

How to move my files stored under my personal computer to my Amazon EC2 instance?


My question may sound funny to some of you since I am new to Terminal/Linux/Amazon AWS. But how can I move (copy) the file that is stored under my personal computer to my Amazon EC2 instance?

Thank you,


Solution

  • You can use scp.

     scp -i privateKey.pem -r ./localDir ec2-user@ip:~
    

    To copy from ec2, reverse the command

    scp -i privateKey.pem -r ec2-user@ip:~/remote-dir ./localDir
    

    Please ec2-user with Ubuntu if you are using Ubuntu. This will copy to the home folder of the instance

    Note: Please note your private key file should not have too open permissions.

    chmod 400 /path/to/privateKeyFile.pem 
    

    hope this helps.