10

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.?

Pramod Gouda
  • 163
  • 2
  • 10
  • 2
    Did you check AWS CLI sync features? http://docs.aws.amazon.com/cli/latest/reference/s3/sync.html – mootmoot Aug 22 '16 at 12:36

2 Answers2

6

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.

Tomasz
  • 5,269
  • 8
  • 56
  • 65
  • 2
    The proposed solution does not work as expected, and versions of files may get overwritten / lost. c.f. [this answer](https://stackoverflow.com/a/45054761/1006854). – Mehdi Mar 31 '19 at 18:03
1

There are products that do this - Open Source Owncloud and NextCloud run on S3 and a local computer and can sync two folders as a two-way near-live mirror a-la Dropbox. Also Resilio Sync uses Bittorrent to do fast two-way mirrors and can run on S3.

Tom Spoon
  • 27
  • 3