AWS S3 sync between buckets overwriting newer destination files

Viewed 12756

We have two s3 buckets, and we have a sync cron job that should copy bucket1 changes to bucket2.

aws s3 sync s3://bucket1/images/ s3://bucket2/images/

When a new image is added to bucket1, it correctly gets copied over to bucket2.

However, if we upload a new version of that image to bucket2, when the sync job next runs it actually copies the older version from bucket1 over to bucket2, replacing the newer version we just put there.

This is part of a migration process, and in time the only place images will be uploaded to will be bucket2, but for the time being sometimes they may be uploaded to either, and we only want changes form bucket1 to be copied up to bucket2, NOT the other way round.

Why does the aws sync job seem to think that the file on bucket1 has changed? Does it not know that the file in bucket2 is newer, so it should be left alone?

1 Answers
Related