3

I have a process that generates log files to the local filesystem, and files that are more than 2 weeks old are automatically purged. I want to use the aws command line tools to sync my folder with S3, with the following behavior:

  • No sync of files from S3 to local
  • Files are not deleted on S3 when they are purged on the local filesystem.

How does S3 sync work in this way?

1

Just use the AWS cli:

$ aws s3 cp --recursive /path/to/local/files/* s3://bucket/

Use a set of IAM credentials that has write-only access to the bucket, so that you can be ensured that no files are ever copied back to the source system.

3
  • This is a solution with extra moving parts. I'd like to achieve this "cp only changed files" (or sync one-way) as well, but without maintaining special IAM policies.
    – Excalibur
    Oct 5 '16 at 18:44
  • @Excalibur Cool story, bro. :) If you have another question, then ask it as a question, not as a comment on a ~1.5-year old answer.
    – EEAA
    Oct 5 '16 at 19:17
  • @EEAA: So, I misunderstood the behavior of the "sync" command, partially due to the title of the OP, in that I thought sync was bidirectional. However, I was wrong, and the standard behavior is what I was looking for. Your answer works as well, provided you're not needing the new/updated-files-only functionality of sync. So ultimately, I have nothing meriting a new "question".
    – Excalibur
    Oct 5 '16 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.