Skip to content

Add a lifecycle configuration to the S3 bucket that stores cyhy-archive backups#880

Open
mcdonnnj wants to merge 3 commits intodevelopfrom
improvement/add_lifecycle_rule_for_cyhy_archive_bucket
Open

Add a lifecycle configuration to the S3 bucket that stores cyhy-archive backups#880
mcdonnnj wants to merge 3 commits intodevelopfrom
improvement/add_lifecycle_rule_for_cyhy_archive_bucket

Conversation

@mcdonnnj
Copy link
Member

@mcdonnnj mcdonnnj commented Aug 4, 2025

🗣 Description

This pull request adds an S3 bucket lifecycle configuration to the bucket that stores cyhy-archive archives. This lifecycle configuration transitions any objects that start with the archive prefix to Glacier Instant Retrieval at 30 days and to Glacier Deep Archive after another 90 days.

💭 Motivation and context

As was pointed out in #871 there are some cost savings to be had by managing the lifecycle of objects we store in S3 long-term. Since we do not typically use this data it makes sense to move it directly into Glacier storage classes once enough time has passed.

🧪 Testing

Automated tests pass.

Note

Once we have settled on storage classes and age for transitioning objects I will deploy this to my test environment and verify that objects are transitioned. As mentioned in the user guide: "the configuration rules apply to both existing objects and objects that you add later".

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All relevant repo and/or project documentation has been updated to reflect the changes in this PR.
  • All new and existing tests pass.

@mcdonnnj mcdonnnj requested review from a team and Copilot August 4, 2025 16:16
@mcdonnnj mcdonnnj self-assigned this Aug 4, 2025
@mcdonnnj mcdonnnj added the improvement This issue or pull request will add or improve functionality, maintainability, or ease of use label Aug 4, 2025
@mcdonnnj mcdonnnj requested a review from dav3r as a code owner August 4, 2025 16:16
@mcdonnnj mcdonnnj added the terraform Pull requests that update Terraform code label Aug 4, 2025
@mcdonnnj mcdonnnj requested review from felddy and jsf9k as code owners August 4, 2025 16:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds S3 bucket lifecycle management to automatically transition archived data to more cost-effective storage classes over time. The lifecycle rule transitions objects with the cyhy_archive_ prefix to Glacier Instant Retrieval after 30 days and to Glacier Deep Archive after 120 days total.

  • Configures lifecycle transitions for cost optimization of long-term archive storage
  • Adds configurable variable for lifecycle rule naming
  • Updates documentation to reflect the new lifecycle configuration resource

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
terraform/variables.tf Adds variable for lifecycle rule name configuration
terraform/cyhy_archive_bucket.tf Implements S3 bucket lifecycle configuration with storage class transitions
terraform/README.md Updates documentation to include the new lifecycle configuration resource and variable

Copy link
Member

@dav3r dav3r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff 👍

@mcdonnnj mcdonnnj force-pushed the improvement/add_lifecycle_rule_for_cyhy_archive_bucket branch from 57b137c to 7463b3a Compare August 4, 2025 18:41
@mcdonnnj mcdonnnj force-pushed the improvement/add_lifecycle_rule_for_cyhy_archive_bucket branch from 7463b3a to 3c5a301 Compare August 22, 2025 06:13
@github-actions github-actions bot added the documentation This issue or pull request improves or adds to documentation label Aug 22, 2025
@mcdonnnj mcdonnnj force-pushed the improvement/add_lifecycle_rule_for_cyhy_archive_bucket branch from 3c5a301 to 93527a4 Compare September 9, 2025 19:19
@mcdonnnj mcdonnnj force-pushed the improvement/add_lifecycle_rule_for_cyhy_archive_bucket branch from 93527a4 to 7ccdb36 Compare September 11, 2025 14:25
Copy link
Member

@jsf9k jsf9k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved again!

mcdonnnj and others added 3 commits September 15, 2025 13:52
This adds a lifecycle configuration to the cyhy-archive S3 bucket that
will transition the cyhy-archive script's output archives to
progressively cheaper to store S3 storage classes. These storage
classes may incur additional charge to access, or require restoration
before they can be accessed, but given how infrequently this data is
accessed we should see notable cost savings.
Directly state the age of an object in the cyhy-archive S3 bucket when
it is transitioned to a new storage class.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: dav3r <david.redmin@gwe.cisa.dhs.gov>
@mcdonnnj mcdonnnj force-pushed the improvement/add_lifecycle_rule_for_cyhy_archive_bucket branch from 7ccdb36 to 72a70d1 Compare September 15, 2025 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation This issue or pull request improves or adds to documentation improvement This issue or pull request will add or improve functionality, maintainability, or ease of use terraform Pull requests that update Terraform code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

5 participants