Description
An OSS lifecycle rule can expire objects or move them to another storage class. A disabled rule leaves matching objects in place.
Potential impact
Keeping objects longer than required can increase costs or violate your retention policy.
Remediation
Check which existing objects match the prefix and age. Exclude anything you must keep before setting lifecycle_rule.enabled = true.
Examples
The rule expires objects under path1/ after 365 days. Review the separate public-read ACL if these objects should be private.
Before
hcl
resource "alicloud_oss_bucket" "example" {
bucket = "bucket-170309-lifecycle"
acl = "public-read"
lifecycle_rule {
id = "rule-days"
prefix = "path1/"
enabled = false
expiration {
days = 365
}
}
}
After
hcl
resource "alicloud_oss_bucket" "example" {
bucket = "bucket-170309-lifecycle"
acl = "public-read"
lifecycle_rule {
id = "rule-days"
prefix = "path1/"
enabled = true
expiration {
days = 365
}
}
}