I have set up 2 ubuntu instances in aws. How do I sync /usr/ubuntu in both the machines?
Asked
Active
Viewed 2,482 times
3
-
The question that is "duplicate" is now about Ubuntu instances in AWS per se... – Ted Cahall Dec 14 '20 at 23:39
3 Answers
2
You can use rsync
command to sync two directories, e.g:
rsync -avzhe "ssh -i yourkey.pem" /usr/ubuntu ubuntu@ec2ip:/usr/ubuntu

Ted Cahall
- 103

Rakesh C
- 131
-
The user in Ubuntu is "ubuntu" and not root. You should add double quotes around the ssh up to the pem file. – Ted Cahall Dec 14 '20 at 23:33
-
rsync -avzhe "ssh -i mypemfile.pem" /home/ubuntu/bin/ ubuntu@ip-1-1-1-1.ec2.internal:/home/ubuntu/bin/ (make sure ssh is set up, using internal host IPs, internal host IPs are added to the security group) – Ted Cahall Dec 14 '20 at 23:36
0
This question has at least two answers.
If you need periodically sync your folders, you can use rsync
.
If you need persistent sync and /usr/ubuntu
is distinguished disk partition, then you can use DRBD
. It's like Net-RAID. Describe and documentation about DRBD
- DRBD official site.

Yurij Goncharuk
- 4,265
0
Set up one of the instances as an NFS server that exports the directory for the other instance to mount.

Kusalananda
- 333,661