You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
![]() |
4 years ago | |
---|---|---|
.. | ||
README.md | 4 years ago |
README.md
Object Lifecycle Configuration Quickstart Guide
![Docker Pulls](https://img.shields.io/docker/pulls/minio/minio.svg?maxAge=604800)
Enable object lifecycle configuration on buckets to setup automatic deletion of objects after a specified number of days or a specified date.
1. Prerequisites
- Install MinIO - MinIO Quickstart Guide.
- Install AWS Cli - Installing AWS Command Line Interface
2. Enable bucket lifecycle configuration
- Create a bucket lifecycle configuration which expires the objects under the prefix
uploads/2015
on2020-01-01T00:00:00.000Z
date and the objects undertemporary-uploads/
after 7 days. Generate it as shown below:
$ cat >bucket-lifecycle.json << EOF
{
"Rules": [
{
"Expiration": {
"Date": "2020-01-01T00:00:00.000Z"
},
"ID": "Delete very old messenger pictures",
"Filter": {
"Prefix": "uploads/2015/"
},
"Status": "Enabled"
},
{
"Expiration": {
"Days": 7
},
"ID": "Delete temporary uploads",
"Filter": {
"Prefix": "temporary-uploads/"
},
"Status": "Enabled"
}
]
}
EOF
- Enable bucket lifecycle configuration using
aws-cli
:
$ export AWS_ACCESS_KEY_ID="your-access-key"
$ export AWS_SECRET_ACCESS_KEY="your-secret-key"
$ aws s3api put-bucket-lifecycle-configuration --bucket your-bucket --endpoint-url http://minio-server-address:port --lifecycle-configuration file://bucket-lifecycle.json
- Verify that the configuration has been added
$ aws s3api get-bucket-lifecycle-configuration --bucket your-bucket --endpoint-url http://minio-server-address:port