Sync files from one EC2 instance to another

12,218

You needn't use your EC2 keys to setup SSH between the two EC2 instances. Look at this guide - http://ask-leo.com/how_can_i_automate_an_sftp_transfer_between_two_servers.html .

Simple outline of the process is, lets say you want to transfer files from Server1 to Server2. You basically create a new key for your user on Server1 (note this is different from the key you downloaded to access your EC2 instance - Server1 in this case). Then load up the public part in Server2's authorized_keys and you should be able to setup SSH.

If the user that the rsync process is going to run under is not your user, then you will have to setup SSH keys for the user that the process will run under.

HTH

Share:
12,218
MrB
Author by

MrB

Updated on June 05, 2022

Comments

  • MrB
    MrB almost 2 years

    I was going to do rsync, but rsync over SSH needs to have the private key on the second EC2 instance. I'm concerned about copying my private SSH key to the server. That can't be safe, right?

    Is there another possibility, e.g. somehow getting authentication via my computer? If it's only a little auth check at the beginning of each sync, I don't mind that.

    Or can I securely sync files between EC2 instances without the private key?

    Thanks for your input, MrB