Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy entire folder from Amazon EC2 Linux instance to local Linux machine?

I connected to Amazon's linux instance from ssh using private key. I am trying to copy entire folder from that instance to my local linux machine .

Can anyone tell me the correct scp command to do this?

Or do I need something more than scp? Both machines are Ubuntu 10.04 LTS

like image 283
Mansoor Elahi Avatar asked Feb 17 '12 14:02

Mansoor Elahi


People also ask

How do I transfer files from AWS EC2 instance to local machine?

Copying files from local to EC2 To copy files between your computer and your instance you can use an FTP service like FileZilla or the command scp . “scp” means “secure copy”, which can copy files between computers on a network. You can use this tool in a Terminal on a Unix/Linux/Mac system.

How do I transfer files from EC2 instance to Linux?

Open a new command prompt and run the following command replacing the fields as needed: scp -P 2222 Source-File-Path user-fqdn @localhost: To copy the entire directory instead of a file, use scp -r before the path. This recursively copies all of the directory's contents to the destination EC2 instance.

Can we copy folder from EC2 to S3?

Transferring Data from EC2 Compute Instances to S3 Buckets on the Same Snowball Edge. You can transfer data between compute instances and Amazon S3 buckets on the same Snowball Edge device. You do this by using the supported AWS CLI commands and the appropriate endpoints.


1 Answers

another way to do it is

scp -i "insert key file here" -r "insert ec2 instance here" "your local directory" 

One mistake I made was scp -ir. The key has to be after the -i, and the -r after that.

so

scp -i amazon.pem -r ec2-user@ec2-##-##-##:/source/dir /destination/dir 
like image 115
Raymond Lui Avatar answered Sep 26 '22 09:09

Raymond Lui