Copying from one AWS instance to another

We normally use a file transfer program like filezilla to transfer files from the local machines to the AWS instances. Most of these programs let you copy from a local machine to a remote server. However, there may be instances when you may want to copy from one AWS instance (aws1) to another (aws2). A program like filezilla do not let you do this. You will be forced to copy from aws1 to local machine and then local machine to aws2. This will lead to a wastage of time and internet bandwidth.

There is however a command that can be run on the AWS instance to copy files directly to another AWS instance. This is very fast and efficient. Assuming that we want to copy from aws1 instance to aws2 instance, run the following on aws1 instance.

scp -i <path to private key of aws2> <files to be copied from aws1 to aws2 <login name for aws2>@<IP address of aws2>:<Target folder on aws2>

For example,
scp -i inventory.pem ordermodule.tar ubuntu@173.93.43.112:/inventory/order

 

Leave a Reply

Your email address will not be published. Required fields are marked *