This post explains how to set up S3 Lifecycle configuration on a S3 bucket using AWS CLI. Lifecycle rules are used to define action you want to take on S3 bucket object's lifetime.
To follow this tutorials you need to have AWS CLI installed and configured, if AWS CLI is not installed or not configured follow below articles to complete the setup.
text_documents/
.To create the rule write below configuration in file named lifecycle.json
.
{
"Rules": [
{
"Filter": {
"Prefix": "text_documents/"
},
"Status": "Enabled",
"Transitions": [
{
"Days": 365,
"StorageClass": "GLACIER"
}
],
"Expiration": {
"Days": 730
},
"ID": "SampleRule"
}
]
}
bucketname
with the your bucket name.
aws s3api put-bucket-lifecycle-configuration --bucket bucketname --lifecycle-configuration file://lifecycle.json
Category: AWS