How to download a file from EC2 instance to Local Computer

So there is common formula

scp -i <private key> <user>@<host>:<server file path> <local path to download file>

Example :

scp -i domain.pem [email protected]:/var/www/html/drupal/web/sites/default/files/test.jpeg /Users/ramesh/Downloads

Below is explanation

  1. private file - .pem file with location
  2. user - Your AWS user
  3. host - Your AWS host URL
  4. sever file path - Full file path from server
  5. local path to download file - Local folder location where you want to store your downloaded file

You can go to you EC2 Instance select it -> Click on Actions -> Connect, you will get the details


I find a simple solution for importing a file from EC2 to local machie

cd ~/.ssh
scp -i mykey.pem [email protected]:/home/path/file ~/Desktop/target

Downloading file to your local machine .....

Hope it will be helpfull to someone


You need to specify your download location. If its the current directory, you can just add a ..

scp -i /home/ritesh/.ssh/id_rsa2 [email protected]:/home/apps/dev/comp-eng/arena-client/build/arena-client-7.1.0.zip .