2026-10-10 02:00:01 [INFO] Log file: /data/log/aws_refinitiv-server-bkup_archive_delete.2318989.log
2026-10-10 02:00:01 [INFO] ******** LIVE MODE ********
2026-10-10 02:00:01 [INFO] Starting backup pruning for plan 'refinitiv-server-bkup'
2026-10-10 02:00:01 [INFO] Found credentials in shared credentials file: ~/.aws/credentials
2026-10-10 02:00:02 [INFO] Found backup plan ID ae987de4-d37f-49df-aab1-e15d35c1a924 for 'refinitiv-server-bkup'.
2026-10-10 02:00:02 [INFO] Vaults used by this plan: backup-daily
2026-10-10 02:00:02 [INFO] Retrieving recovery points from vault 'backup-daily'...
2026-10-10 02:00:02 [INFO]   Found 8 recovery points in backup-daily
2026-10-10 02:00:02 [INFO] Total recovery points found: 8
2026-10-10 02:00:02 [INFO] Monthly archive months: 2026-10, 2026-09, 2026-08, 2026-07, 2026-06, 2026-05, 2026-04, 2026-03, 2026-02, 2026-01, 2025-12, 2025-11
2026-10-10 02:00:02 [INFO] Weekly retention Mondays: 2026-09-21, 2026-09-28, 2026-10-05
2026-10-10 02:00:02 [INFO] ==================================================
2026-10-10 02:00:02 [INFO] KEEP: 6 recovery points
2026-10-10 02:00:02 [INFO] KEEP: arn:aws:ec2:us-west-2::image/ami-0559aa9933cc7cc8c | 2026-09-21 04:00:00+00:00 | EC2
2026-10-10 02:00:02 [INFO] KEEP: arn:aws:ec2:us-west-2::image/ami-0c1bd78fb5db8fecb | 2026-09-28 04:00:00+00:00 | EC2
2026-10-10 02:00:02 [INFO] KEEP: arn:aws:ec2:us-west-2::image/ami-008323807de8cdd32 | 2026-10-05 04:00:00+00:00 | EC2
2026-10-10 02:00:02 [INFO] KEEP: arn:aws:ec2:us-west-2::image/ami-02ca50ba9ba51d544 | 2026-10-08 04:00:00+00:00 | EC2
2026-10-10 02:00:02 [INFO] KEEP: arn:aws:ec2:us-west-2::image/ami-001ec5a575c53b9b0 | 2026-10-09 04:00:00+00:00 | EC2
2026-10-10 02:00:02 [INFO] KEEP: arn:aws:ec2:us-west-2::image/ami-054c0114a3471bb64 | 2026-10-10 04:00:00+00:00 | EC2
2026-10-10 02:00:02 [INFO] ==================================================
2026-10-10 02:00:02 [INFO] ARCHIVE: 1 recovery points
2026-10-10 02:00:02 [INFO] ARCHIVE: arn:aws:ec2:us-west-2::image/ami-0c6d2d21103750e49 | AMI=ami-0c6d2d21103750e49 | 4250.00 GB | METHOD=S3-DEEP-ARCHIVE | 2026-10-01 04:00:00+00:00
2026-10-10 02:00:02 [INFO] ==================================================
2026-10-10 02:00:02 [INFO] SKIP: 0 recovery points
2026-10-10 02:00:02 [INFO] ==================================================
2026-10-10 02:00:02 [INFO] DELETE: 1 recovery points
2026-10-10 02:00:02 [INFO] DELETE: arn:aws:ec2:us-west-2::image/ami-03f3f47e24c6cd21a | 2026-10-07 04:00:00+00:00 | EC2
2026-10-10 02:00:02 [INFO] Waiting for global AMI archive lock...
2026-10-10 02:00:03 [INFO] AMI archive lock acquired.
2026-10-10 02:00:03 [INFO] Starting S3 Deep Archive workflow for ami-0c6d2d21103750e49
2026-10-10 02:00:03 [INFO] AMI ami-0c6d2d21103750e49 is 4250.00 GB <= 5000 GB. Using S3-DEEP-ARCHIVE.
2026-10-10 02:00:03 [INFO] ==================================================
2026-10-10 02:00:03 [INFO] ARCHIVING AMI: ami-0c6d2d21103750e49
2026-10-10 02:00:03 [INFO] Creating S3 AMI store task for ami-0c6d2d21103750e49...
2026-10-10 02:00:03 [ERROR] ARCHIVE FAILED for ami-0c6d2d21103750e49. Recovery point WILL NOT be deleted.
Traceback (most recent call last):
  File "/home/prod/gqr/extra/env/prune_aws_backups_by_plan.py", line 1483, in main
    final_key = archive_ami_to_deep_archive(
  File "/home/prod/gqr/extra/env/prune_aws_backups_by_plan.py", line 874, in archive_ami_to_deep_archive
    response = ec2_client.create_store_image_task(
  File "/home/prod/miniconda3/envs/env1/lib/python3.9/site-packages/botocore/client.py", line 569, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/home/prod/miniconda3/envs/env1/lib/python3.9/site-packages/botocore/client.py", line 1023, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidRequest) when calling the CreateStoreImageTask operation: The AMI already exists in the bucket. You can't create multiple copies of an AMI in the same S3 bucket.
2026-10-10 02:00:03 [INFO] AMI archive lock released.
2026-10-10 02:00:03 [INFO] Deleting old recovery point: arn:aws:ec2:us-west-2::image/ami-03f3f47e24c6cd21a
2026-10-10 02:00:03 [INFO] Deleted old recovery point: arn:aws:ec2:us-west-2::image/ami-03f3f47e24c6cd21a
2026-10-10 02:00:03 [INFO] ==================================================
2026-10-10 02:00:03 [INFO] JOB COMPLETE for backup plan 'refinitiv-server-bkup'.
2026-10-10 02:00:03 [INFO] ==================================================
