rsync to AWS EC2 Using PEM Key - suguanyu/WechatTinyProgram GitHub Wiki
For the convenience of developing on desktop for a EC2 machine. People usually hope to make it easy to copy local debugged code to remote mahcine. Rsync is good tool to sync local code to EC2. The basic usage of rysnc is like: http://linuxcommand.org/man_pages/rsync1.html
One particularity for EC2 is it need identify for ssh.
Pass the PEM file to SSH using the rave parameter, the CMD template we can use is:
rsync -rave "ssh -i /path/to/EC2_KEY.pem" /path/to/local/files/* EC2_USER@EC2_INSTANCE:/path/to/remote/files
Note that , in the "ssh -i /path/to/EC2_KEY.pem", you should use the absolute path and don't use "~" replace the home path.