Automatic Object Expiration
Each procedure on this page creates a new object lifecycle management rule that expires objects on a Buckit bucket. This procedure supports use cases like removing “old” objects after a certain time period or calendar date.
Requirements
Install and Configure bm
This procedure uses bm for performing operations on the Buckit cluster.
Install bm on a machine with network access to both source and destination
clusters. See the bm Installation Quickstart for
instructions on downloading and installing bm.
Use the bm alias set command to create an alias for the source Buckit cluster
and the destination S3-compatible service. Alias creation requires specifying an
access key for a user on the source and destination clusters. The specified
users must have permissions for configuring
and applying expiry operations.
Required Permissions
Buckit requires the following permissions scoped to the bucket or buckets for which you are creating lifecycle management rules.
Buckit also requires the following administrative permissions on the cluster in which you are creating remote tiers for object transition lifecycle management rules:
For example, the following policy provides permission for configuring object transition lifecycle management rules on any bucket in the cluster:.
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"admin:SetTier",
"admin:ListTier"
],
"Effect": "Allow",
"Sid": "EnableRemoteTierManagement"
},
{
"Action": [
"s3:PutLifecycleConfiguration",
"s3:GetLifecycleConfiguration"
],
"Resource": [
"arn:aws:s3:::*"
],
"Effect": "Allow",
"Sid": "EnableLifecycleManagementRules"
}
]
}
Expire Objects after Number of Days
Use bm ilm rule add with --expire-days to
expire bucket contents a number of days after object creation:
bm ilm rule add ALIAS/PATH --expire-days "DAYS"
Expire Versioned Objects
Use bm ilm rule add to expiring noncurrent object versions and object
delete markers:
To expire noncurrent object versions after a specific duration in days, include
--noncurrent-expire-days.To expire delete markers for objects with no remaining versions, include
--expire-delete-marker.
bm ilm rule add ALIAS/PATH \
--noncurrent-expire-days NONCURRENT_DAYS \
--expire-delete-marker
To expire all versions of an object, include
--expire-all-object-versions. This expiration only applies to objects without aDeleteMarkeras the latest or current version.bm ilm rule add ALIAS/PATH \ --expire-all-object-versions
Replace
PATHwith the path to the bucket on the S3-compatible host.Replace
NONCURRENT_DAYSwith the number of days after which to expire noncurrent object versions. For example, specify30dto expire a version after it has been noncurrent for at least 30 days.