How to synchronize website from locahost into ec2 amazon using rsync
We have files in our locahost and want to upload it into our ec2 amazon server using commandline. We know that AWS just support SSH as default main communication between client and server. FTP is difficult to be installed also SFTP will makes uploading time so long. Why don't use rsync as default command in Linux? We can synchronize files in our computer into ec2 server easily. Here are commandline for rsync between client and ec2 server :
In this example, we in directory where our .pem key located for easy managing. You want to syncronize content in YOURLOCAHOSTFOLDER into /var/www in your ec2 amazon server.
EC2 instance example is ubuntu@ec2-IP-ADDRESS.compute.amazonaws.com.
sudo rsync -avr /YOURLOCAHOSTFOLDER/* -e "ssh -i YOURKEYPEM.pem" ubuntu@ec2-IP-ADDRESS.compute.amazonaws.com:/var/www/You can create this command as rsync.sh and execute by sudo sh rsync.sh.
Comments
Andre Lesa (not verified)
Fri, 02/17/2012 - 17:36
Permalink
Hi,Thanks for that.but I have
Hi,Thanks for that.but I have a problem,when I enter that command,it just hangs without doing anything.
admin
Mon, 02/20/2012 - 10:12
Permalink
Paste
Make sure you do the right command. Try with ssh into server first and check the correct path to synchronize.
Andre Lesa (not verified)
Mon, 02/27/2012 - 03:43
Permalink
Thanks,I was just on a slow
Thanks,I was just on a slow link.
Lucas Pottersky (not verified)
Mon, 04/30/2012 - 04:34
Permalink
Exactly what I needed! Thanks
Exactly what I needed! Thanks! You were on #1 Google Results for me for "rsync .pem". Funny, uh?
admin
Mon, 04/30/2012 - 23:22
Permalink
LOL
LOL
andy (not verified)
Thu, 05/10/2012 - 09:37
Permalink
Great and easy to follow
Great and easy to follow instructions. Thanks.
PS. I had to remove "/" in "/YOURLOCAHOSTFOLDER" in order for me to wrok.
Add new comment