April 16, 2015
rsync files from vagrant box to AWS server
I just transferred a directory full of audio files that I didn’t want to check into a project’s Git repository with this command:
rsync -avz -e "ssh -i /home/vagrant/key.pem" ./source-directory user@host.ca:/home/user/destination-directory
notes:
- key.pem is the same file I usually SSH into the host AWS server with
- copy the key file from the Vagrant box’s host machine (my dev machine) into a non-shared directory in the Vagrant machine (
/home/vagrant), and set the permissions on it to0600, otherwise rsync complains that the key has the wrong permissions and the command does not work. aflag means archive mode which preserves more properties of files and is recursivevflag means verbosezflag enables compressioneflag specifies the remote shell user to use (the usual user I SSH as). This is the most important flag to understand for my use case