Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bidirectional synchronisation between Amazon s3 bucket and physical server

We have a folder in physical server and need to synchronise with one of our Aws s3 bucket. But here the requirement is , we have to synchronise the contents in both the ways (Changes done in the physical server should reflect in Aws S3 bucket and vice versa).Is it possible.?

like image 684
Pramod Gouda Avatar asked Aug 22 '16 12:08

Pramod Gouda


People also ask

Is AWS sync bidirectional?

Note that sync is one-way, so you have to issue two separate commands switching source and target to achieve bidirectional sync. aws s3 sync s3://mybucket . Running both will get you both directions of the sync.

Does S3 have cross-region replication?

S3 Cross-Region Replication (CRR) is used to copy objects across Amazon S3 buckets in different AWS Regions.

How can a company configure automatic asynchronous copying of objects in Amazon S3 buckets across regions?

With Amazon S3 Replication, you can configure Amazon S3 to automatically replicate S3 objects across different AWS Regions by using S3 Cross-Region Replication (CRR) or between buckets in the same AWS Region by using S3 Same-Region Replication (SRR).


1 Answers

Use AWS CLI S3 sync. Note that sync is one-way, so you have to issue two separate commands switching source and target to achieve bidirectional sync.

From local directory to S3

aws s3 sync . s3://mybucket

From S3 to local directory

aws s3 sync s3://mybucket .

Running both will get you both directions of the sync.

As pointed out in the comments below each time you modify S3 or your local folder you need to sync in the opposite direction or risk overwriting updated files later.

like image 129
Tomasz Avatar answered Sep 29 '22 22:09

Tomasz