From d6f6669610628e5ad22302e63d76a3d797275934 Mon Sep 17 00:00:00 2001 From: Ken Tsang Date: Wed, 21 Mar 2018 16:29:48 +0000 Subject: [PATCH] Add comments for copying s3 objects --- app/letters/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/letters/utils.py b/app/letters/utils.py index 2a6f2bbd6..83af29b86 100644 --- a/app/letters/utils.py +++ b/app/letters/utils.py @@ -97,6 +97,10 @@ def move_scanned_pdf_to_letters_pdf_bucket(filename): target_filename = get_folder_name(datetime.utcnow()) + filename target_bucket = s3.Bucket(target_bucket_name) obj = target_bucket.Object(target_filename) + + # Tags are copied across but the expiration time is reset in the destination bucket + # e.g. if a file has 5 days left to expire on a ONE_WEEK retention in the source bucket, + # in the destination bucket the expiration time will be reset to 7 days left to expire obj.copy(copy_source, ExtraArgs={'ServerSideEncryption': 'AES256'}) s3.Object(source_bucket_name, filename).delete()