node.jsamazon-web-servicesamazon-s3pugstylus

How does `aws s3 sync` determine if a file has been updated?


When I run the command in the terminal back to back, it doesn't sync the second time. Which is great! It shouldn't. But, if I run my build process and run aws s3 sync programmatically, back to back, it syncs all the files both times, as if my build process is changing something differently the second time.

Can't figure out what might be happening. Any ideas?

My build process is basically pug source/ --out static-site/ and stylus -c styles/ --out static-site/styles/


Solution

  • According to this - http://docs.aws.amazon.com/cli/latest/reference/s3/sync.html

    S3 sync compares the size of the file and the last modified timestamp to see if a file needs to be synced.

    In your case, I'd suspect the build system is resulting in a newer timestamp even though the file size hasn't changed?