S3 bucket lifecycle setup¶
Lifecycle configuration for S3 is applied through tag-associated filters, see configuration elements for details. This assumes objects have a tag with a limited set of values, and buckets have a set of rules based on the value of that tag.
Warning
Migration is strictly required for the lifecycle configuration to be fully applied, for the following reasons:
buckets with no rules will not delete objects even if the user specifies a lifetime for an particular object
objects with no tags will never be deleted even if the user specifies a lifetime for the bucket
Migration routine¶
Migration could be run from base_scripts/migrate_settings_tags.
Permission issues¶
By default, all the S3 resources are private, including buckets, objects, and lifecycle configuration. If needed, rules and default tags could be created manually by resource owner using one of the applicable methods. Please refer to the S3 documentation for details.
Further work¶
From now on, all the buckets manually created by resource owner should be supplemented with a number of TTL-associated tag rules:
{
"ID": "vl-expire-<ttl>}",
"Expiration": {"Days": <ttl>},
"Filter": {"Tag": {"Key": "vl-expire", "Value": <ttl>}},
"Status": "Enabled",
}
for ttl in (1, 2, 3, 4, 5, 6, 7, 14, 30, 60, 90, 180, 365)
as well as a default rule for the bucket (if necessary):
{
"ID": "vl-expire",
"Expiration": {"Days": <default-ttl>},
"Filter": {"Tag": {"Key": "vl-expire", "Value": "default"}},
"Status": "Enabled",
}