Sync files from one EC2 instance to another
Asked Answered
A

2

4

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

Arcadian answered 5/8, 2011 at 23:45 Comment(0)
S
8

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

Sumbawa answered 5/8, 2011 at 23:56 Comment(2)
The guide you linked to is actually pretty bad, but you said it pretty well yourself ;-)Arcadian
@Arcadian thats a good guide. You are right the first link I had was no good, I found another one that covers sftp and rsync as well. I have edited my answer with the new link.Sumbawa
S
0

Just create a snapshot of the volume you have your modified files contained and attach it your outdated instance after detaching the outdated volume.

Sabbatical answered 7/1, 2013 at 15:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.