Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to sync my local files through a gateway to an Amazon EC2 instance that requires specifying my .pem key. I can do this as a three step like so (assuming no typos):

  • rsync -avzh -e ssh /my_site/ user@XX.XX.XX.XX:/temp_destination/
  • ssh to the gateway
  • rsync -avzh -e "ssh - My_Key.pem" temp_destination/ user@XX.XX.XX.XXX:/var/www

I'd like to get this into one single command, but I'm wrestling through the flags and options and can't seem to get anything to work that lets me specify my .pem key.


share|improve this question
Can't answer my own question for another 7 hours, so in case I forget, I found the answer: rsync -avzh --stats --progress -e "ssh ssh -i MY_KEY.pem" ~/Sites/my_site/ user@remote.server:/var/www/ – Jack McDade Sep 13 '13 at 19:53
up vote 1 down vote accepted

Figured it out, posting the answer for future devs.

rsync -avzh --stats --progress \
  -e "ssh ssh -i My_Key.pem" \
   ~/Sites/my_site/ \
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .