Reputation: 7639
i have an instance of ec2.it have some files.i tried to download my file from ec2 instance to my local Ubuntu 13.10.i run this command
scp -i /home/ritesh/.ssh/id_rsa2 [email protected]:/home/apps/dev/comp-eng/arena-client/build/arena-client-7.1.0.zip
and in output i am getting
usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [[user@]host1:]file1 ... [[user@]host2:]file2
i am using correct format i think.why i am facing this error instead of downloading file ??
Upvotes: 13
Views: 48939
Reputation: 365
An alternative simple method:
Ec2 allows you to manually download a file.
Thus, if we zip the folder, it becomes a file.
Step 1.
zip -r zipfile.zip folder_name/
Step 2. Right click file and download.
Upvotes: 0
Reputation: 1526
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
You can go to you EC2 Instance select it -> Click on Actions -> Connect, you will get the details
Upvotes: 7
Reputation: 433
For EC2 ubuntu
go to your .pem file directory
scp -i yourkey.pem ec2user@DNS_name:/home/ubuntu/foldername/filename ~/Desktop/localfolder
Upvotes: -1
Reputation: 1212
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
Upvotes: 11
Reputation: 19563
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 .
Upvotes: 27