Transfer Data in between Ubuntu instances
1 min readNov 23, 2020
Actually, I figured it out … I just needed to replace the Elastic IP with the private IP and configure the security groups properly to allow instances to communicate!
Transferring from Machine A to Machine B
I am running this code on machine A
scp -i ~/Path-To-Key-File/AAA.pem /path/file ec2-user@<Private IP of Machine B>:/path/file
If you’re going to transfer a directory, use this
scp -r -i ~/Path-To-Key-File/AAA.pem /path/file ec2-user@<Private IP of Machine B>:/path/file
If you want to transfer data from your local ubuntu machine to a remote server/instance, use this:
scp -i path/to/local/keypair.pem path/to/local/file.ext user@remote-host:path/to/remote/file.ext
If you want to transfer data from your remote machine to local, use this:
scp -i path/to/local/keypair.pem user@remote-host:path/to/remote/file.ext path/to/download/file
If you face this error
scp: /home/ubuntu/dump: not a regular file
It means the source file is not a regular file. Rather its a directory. To copy this, use -r
flag as in the second command of this article.