Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to enable S3 lifecycle for snapshot bucket. #108

Closed

Conversation

owl-king
Copy link
Contributor

@owl-king owl-king commented Aug 2, 2024

This allows enable/disable S3 lifecycle for snapshot bucket for cost saving.
Default: Enable for 7 days

@owl-king
Copy link
Contributor Author

owl-king commented Aug 2, 2024

Plan output on dev*

# aws_s3_bucket_lifecycle_configuration.indexer_full_node_snapshots[0] will be created
  + resource "aws_s3_bucket_lifecycle_configuration" "indexer_full_node_snapshots" {
      + bucket = "dev*-full-node-snapshots"
      + id     = (known after apply)

      + rule {
          + id     = "expire-old-snapshots"
          + status = "Enabled"

          + expiration {
              + days                         = 3
              + expired_object_delete_marker = (known after apply)
            }
        }
    }

# Enable S3 snapshot lifecycle to clean up old snapshots
resource "aws_s3_bucket_lifecycle_configuration" "indexer_full_node_snapshots" {
count = var.enable_s3_snapshot_lifecycle ? 1 : 0
bucket = aws_s3_bucket.indexer_full_node_snapshots.id
Copy link
Contributor

Choose a reason for hiding this comment

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

are there other buckets (i.e. load_balancer logs) that the lifecycle should apply to?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. I will add lifecycle to other buckets

default = true
}

variable "snapshot_bucket_expiration_days" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
variable "snapshot_bucket_expiration_days" {
variable "s3_snapshot_expiration_days" {

@owl-king
Copy link
Contributor Author

owl-king commented Aug 7, 2024

Close the PR as the workflow changed to optimize-aws-cost branch

@owl-king owl-king closed this Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants