Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

Thoughts?

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 user@gatway.host ssh -i MY_KEY.pem" ~/Sites/my_site/ user@remote.server:/var/www/ –  Jack McDade Sep 13 '13 at 19:53
add comment

1 Answer

up vote 1 down vote accepted

Figured it out, posting the answer for future devs.

rsync -avzh --stats --progress \
  -e "ssh user@gateway.host ssh -i My_Key.pem" \
   ~/Sites/my_site/ \ 
   user@ec2.host:/var/www/
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.