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?

Scott Switzer
  • 133
  • 1
  • 3

1 Answers1

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.

EEAA
  • 108,414
  • 18
  • 172
  • 242
  • 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 05 '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 05 '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 05 '16 at 20:38