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
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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With