1
0
mirror of https://github.com/minio/docs.git synced 2025-12-05 20:02:06 +03:00
Files
docs/source/administration/object-management/create-lifecycle-management-expiration-rule.rst
Daryl White 00de8dbeb6 Updates to mc docs for December 2022 releases (#697)
This PR applies updates to numerous files to address changes in the two
December 2022 `mc` releases.

- Deprecates `mc admin bucket quota` and links to new commands
- Adds `mc quota set | clear | info` commands
- Adds `attach | detach` subcommands to `mc admin idp ldap policy`
- Updates list of call types available to `mc admin trace`
- Updates `mc` page with new commands
- Fixes minor errors in `mc cp`
- Adds `--limit-*` flags to global flag options
- Adds `--versions` flag to `mc find`
    
Closes #685

- Updates ilm commands for new structure for tiers and rules
    
    - Deprecates `mc admin tier`
- Deprecates `mc ilm add | edit | export | import | ls | rm` commands
    - Adds new `mc ilm rule` and six subcommands
    - Adds new `mc ilm tier` and six subcommands
    - Updates references to ilm and admin tier  commands throughout docs
    - Adds new deprecated commands page
    - Adds `mc ilm rule` and `mc ilm tier` holding pages with toctrees

- Closes #691
- Closes #662
2023-01-10 15:47:02 -06:00

3.7 KiB

Automatic Object Expiration

minio

Table of Contents

Each procedure on this page creates a new object lifecycle management rule that expires objects on a MinIO bucket. This procedure supports use cases like removing "old" objects after a certain time period or calendar date.

Requirements

Install and Configure mc

This procedure uses mc for performing operations on the MinIO cluster. Install mc on a machine with network access to both source and destination clusters. See the mc Installation Quickstart <mc-install> for instructions on downloading and installing mc.

Use the mc alias command to create an alias for the source MinIO 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 <minio-lifecycle-management-create-expiry-rule-permissions> for configuring and applying expiry operations.

Required Permissions

MinIO requires the following permissions scoped to the bucket or buckets for which you are creating lifecycle management rules.

  • s3:PutLifecycleConfiguration
  • s3:GetLifecycleConfiguration

MinIO also requires the following administrative permissions on the cluster in which you are creating remote tiers for object transition lifecycle management rules:

  • admin:SetTier
  • admin:ListTier

For example, the following policy provides permission for configuring object transition lifecycle management rules on any bucket in the cluster:.

/extra/examples/LifecycleManagementAdmin.json

Expire Objects after Number of Days

Use mc ilm rule add with ~mc ilm rule add --expire-days to expire bucket contents a number of days after object creation:

mc ilm rule add ALIAS/PATH --expire-days "DAYS" 
  • Replace ALIAS <mc ilm rule add ALIAS> with the alias <mc alias> of the S3-compatible host.
  • Replace PATH <mc ilm rule add ALIAS> with the path to the bucket on the S3-compatible host.
  • Replace DAYS <mc ilm rule add --expire-days> with the number of days after which to expire the object. For example, specify 30 to expire the object 30 days after creation.

Expire Versioned Objects

Use mc ilm rule add to expiring noncurrent object versions and object delete markers:

  • To expire noncurrent object versions after a specific duration in days, include ~mc ilm rule add --noncurrent-expire-days.
  • To expire delete markers for objects with no remaining versions, include ~mc ilm rule add --expire-delete-marker.
mc ilm rule add ALIAS/PATH \ 
   --noncurrent-expire-days NONCURRENT_DAYS \
   --expire-delete-marker
  • Replace ALIAS <mc ilm rule add ALIAS> with the alias <mc alias> of the S3-compatible host.
  • Replace PATH <mc ilm rule add ALIAS> with the path to the bucket on the S3-compatible host.
  • Replace NONCURRENT_DAYS <mc ilm rule add --noncurrent-expire-days> with the number of days after which to expire noncurrent object versions. For example, specify 30d to expire a version after it has been noncurrent for at least 30 days.