Welcome to the upcoming version of the MinIO Documentation! The content on this page is under active development and may change at any time. If you can't find what you're looking for, check our legacy documentation. Thank you for your patience.

mc ilm

Description

The mc ilm command manages object lifecycle management rules on a bucket. See the AWS documentation on Object Lifecycle Management for more information.

Lifecycle Management Object Scanner

MinIO uses a scanner process to check objects against all configured lifecycle management rules. Slow scanning due to high IO workloads or limited system resources may delay application of lifecycle management rules. See Lifecycle Management Object Scanner for more information.

Expiry vs Transition

MinIO supports specifying both expiry and transition rules in the same bucket or bucket prefix. MinIO can execute an expiration rule on an object regardless of its transition status. Use mc ilm list to review the currently configured object lifecycle management rules for any potential interactions between expiry and transition rules.

Examples

Expire Bucket Contents After Specific Date

Use mc ilm add with --expiry-date to expire bucket contents after a specific date.

mc ilm add ALIAS/PATH --expiry-date "DATE"
  • Replace ALIAS with the alias of the S3-compatible host.

  • Replace PATH with the path to the bucket on the S3-compatible host.

  • Replace DATE with the calendar date after which to expire the object. For example, specify “2021-01-01” to expire objects after January 1st, 2021.

Expire Bucket Contents After Number of Days

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

mc ilm add ALIAS/PATH --expiry-days "DAYS"
  • Replace ALIAS with the alias of the S3-compatible host.

  • Replace PATH with the path to the bucket on the S3-compatible host.

  • Replace DATE with the number of days after which to expire the object. For example, specify 30d to expire the object 30 days after creation.

List Bucket Lifecycle Management Rules

Use mc ilm list to list a bucket’s lifecycle management rules:

mc ilm list ALIAS/PATH
  • Replace ALIAS with the alias of the S3-compatible host.

  • Replace PATH with the path to the bucket on the S3-compatible host.

Remove a Bucket Lifecycle Management Rule

Use mc ilm remove to remove a bucket lifecycle management rule:

mc ilm remove --id "RULE" ALIAS/PATH
  • Replace RULE with the unique name of the lifecycle management rule.

  • Replace ALIAS with the alias of the S3-compatible host.

  • Replace PATH with the path to the bucket on the S3-compatible host.

Syntax

mc ilm list

Lists the current lifecycle management rules of the specified bucket. The subcommand has the following syntax:

mc ilm list TARGET [FLAGS]

The subcommand supports the following arguments:

TARGET

Required The full path to the bucket from which to list existing lifecycle management rules. Specify the alias of a configured S3 service as the prefix to the TARGET path.

For example:

mc ilm list play/mybucket
--expiry

mc ilm returns only fields related to lifecycle rule expiration.

--transition

mc ilm returns only fields related to lifecycle rule transition.

--minimum

mc ilm returns only the following fields:

  • id

  • prefix

  • status

  • transition set

  • expiry set

mc ilm add

Adds a new bucket lifecycle management rules. The command has the following syntax:

mc ilm add TARGET [FLAGS]
TARGET

Required

The full path to the bucket from which to add the lifecycle management rule. Specify the alias of a configured S3 service as the prefix to the TARGET path.

For example:

mc ilm add play/mybucket [FLAGS]
--prefix

The path to the specific subset of the TARGET bucket on which to apply the lifecycle configuration rule. MinIO appends the --prefix field to the TARGET path to construct the full path.

Omit to apply the rule to the entire TARGET bucket.

--tags

One or more ampersand &-delimited key-value pairs describing the object tags to which to apply the lifecycle configuration rule.

This option is mutually exclusive with the following option:

--expiry-date

The ISO-8601-formatted calendar date until which MinIO retains an object after being created. MinIO marks the object for deletion once the system host datetime passes that calendar date.

Specifying a calendar date that is prior to the current system host datetime marks all objects covered by the rule for deletion.

For versioned buckets, the expiry rule applies only to the current object version. Use the --noncurrentversion-expiration-days option to apply expiration behavior to noncurrent object versions.

MinIO uses a scanner process to check objects against all configured lifecycle management rules. Slow scanning due to high IO workloads or limited system resources may delay application of lifecycle management rules. See Lifecycle Management Object Scanner for more information.

Mutually exclusive with the following options:

--expiry-days

The number of days to retain an object after being created. MinIO marks the object for deletion after the specified number of days pass.

For versioned buckets, the expiry rule applies only to the current object version. Use the --noncurrentversion-expiration-days option to apply expiration behavior to noncurrent object versions.

MinIO uses a scanner process to check objects against all configured lifecycle management rules. Slow scanning due to high IO workloads or limited system resources may delay application of lifecycle management rules. See Lifecycle Management Object Scanner for more information.

Mutually exclusive with the following options:

--noncurrentversion-expiration-days

The number of days to retain an object version after becoming non-current (i.e. a different version of that object is now the HEAD). MinIO marks noncurrent object versions for deletion after the specified number of days pass.

This option has the same behavior as the S3 NoncurrentVersionExpiration action.

MinIO uses a scanner process to check objects against all configured lifecycle management rules. Slow scanning due to high IO workloads or limited system resources may delay application of lifecycle management rules. See Lifecycle Management Object Scanner for more information.

--expired-object-delete-marker

Specify this option to direct MinIO to remove delete markers for objects with no remaining object versions. Specifically, the delete marker is the only remaining “version” of the given object.

This option is mutually exclusive with the following option:

MinIO uses a scanner process to check objects against all configured lifecycle management rules. Slow scanning due to high IO workloads or limited system resources may delay application of lifecycle management rules. See Lifecycle Management Object Scanner for more information.

--transition-date

The ISO-8601-formatted calendar date after which MinIO marks an object as eligible for transition to the remote tier. MinIO transitions the object to the configured remote storage tier specified to the --storage-class once the system host datetime passes that calendar date.

For versioned buckets, the transition rule applies only to the current object version. Use the --noncurrentversion-transition-days option to apply transition behavior to noncurrent object versions.

MinIO uses a scanner process to check objects against all configured lifecycle management rules. Slow scanning due to high IO workloads or limited system resources may delay application of lifecycle management rules. See Lifecycle Management Object Scanner for more information.

--transition-days

The number of calendar days from object creation after which MinIO marks an object as eligible for transition. MinIO transitions the object to the configured remote storage tier specified to the --storage-class.

For versioned buckets, the transition rule applies only to the current object version. Use the --noncurrentversion-transition-days option to apply transition behavior to noncurrent object versions.

MinIO uses a scanner process to check objects against all configured lifecycle management rules. Slow scanning due to high IO workloads or limited system resources may delay application of lifecycle management rules. See Lifecycle Management Object Scanner for more information.

--noncurrentversion-transition-days

The number of days an object has been non-current (i.e. replaced by a newer version of that same object) after which MinIO marks the object version as eligible for transition. MinIO transitions the object to the configured remote storage tier specified to the --storage-class once the system host datetime passes that calendar date.

This option has no effect on non-versioned buckets.

This option has the same behavior as the S3 NoncurrentVersionTransition action.

MinIO uses a scanner process to check objects against all configured lifecycle management rules. Slow scanning due to high IO workloads or limited system resources may delay application of lifecycle management rules. See Lifecycle Management Object Scanner for more information.

--storage-class

The remote storage tier to which MinIO transition objects. Specify a remote storage tier created by mc admin tier.

If using mc ilm add against an Amazon S3 service, this argument is the Amazon S3 storage class to transition objects covered by the rule. See Transition objects using Amazon S3 Lifecycle for more information on S3 storage classes.

--disable

Disables the rule.

To enable a disabled rule, specify --disable=false

mc ilm edit

Edits an existing lifecycle management rule in the bucket. The command has the following syntax:

mc ilm edit --id "RULE_ID" TARGET [FLAGS]

The command supports the following arguments:

TARGET

Required

The full path to the bucket from which to modify the specified lifecycle management rule. Specify the alias of a configured S3 service as the prefix to the TARGET path.

For example:

mc ilm edit --id "RULE_ID" play/mybucket [FLAGS]
--id

Required

The unique ID of the rule. Use mc ilm list to list bucket rules and retrieve the id for the rule you want to modify.

--tags

One or more ampersand &-delimited key-value pairs describing the object tags to which to apply the lifecycle configuration rule.

This option is mutually exclusive with the following option:

--expiry-date

The ISO-8601-formatted calendar date until which MinIO retains an object after being created. MinIO marks the object for deletion once the system host datetime passes that calendar date.

Specifying a calendar date that is prior to the current system host datetime marks all objects covered by the rule for deletion.

For versioned buckets, the expiry rule applies only to the current object version. Use the --noncurrentversion-expiration-days option to apply expiration behavior to noncurrent object versions.

MinIO uses a scanner process to check objects against all configured lifecycle management rules. Slow scanning due to high IO workloads or limited system resources may delay application of lifecycle management rules. See Lifecycle Management Object Scanner for more information.

Mutually exclusive with the following options:

--expiry-days

The number of days to retain an object after being created. MinIO marks the object for deletion after the specified number of days pass.

For versioned buckets, the expiry rule applies only to the current object version. Use the --noncurrentversion-expiration-days option to apply expiration behavior to noncurrent object versions.

MinIO uses a scanner process to check objects against all configured lifecycle management rules. Slow scanning due to high IO workloads or limited system resources may delay application of lifecycle management rules. See Lifecycle Management Object Scanner for more information.

Mutually exclusive with the following options:

--noncurrentversion-expiration-days

The number of days to retain an object version after becoming non-current (i.e. a different version of that object is now the HEAD). MinIO marks noncurrent object versions for deletion after the specified number of days pass.

This option has the same behavior as the S3 NoncurrentVersionExpiration action.

MinIO uses a scanner process to check objects against all configured lifecycle management rules. Slow scanning due to high IO workloads or limited system resources may delay application of lifecycle management rules. See Lifecycle Management Object Scanner for more information.

--expired-object-delete-marker

Specify this option to direct MinIO to remove delete markers for objects with no remaining object versions. Specifically, the delete marker is the only remaining “version” of the given object.

This option is mutually exclusive with the following option:

MinIO uses a scanner process to check objects against all configured lifecycle management rules. Slow scanning due to high IO workloads or limited system resources may delay application of lifecycle management rules. See Lifecycle Management Object Scanner for more information.

--transition-date

The ISO-8601-formatted calendar date after which MinIO marks an object as eligible for transition to the remote tier. MinIO transitions the object to the configured remote storage tier specified to the --storage-class once the system host datetime passes that calendar date.

For versioned buckets, the transition rule applies only to the current object version. Use the --noncurrentversion-transition-days option to apply transition behavior to noncurrent object versions.

MinIO uses a scanner process to check objects against all configured lifecycle management rules. Slow scanning due to high IO workloads or limited system resources may delay application of lifecycle management rules. See Lifecycle Management Object Scanner for more information.

--transition-days

The number of calendar days from object creation after which MinIO marks an object as eligible for transition. MinIO transitions the object to the configured remote storage tier specified to the --storage-class.

For versioned buckets, the transition rule applies only to the current object version. Use the --noncurrentversion-transition-days option to apply transition behavior to noncurrent object versions.

MinIO uses a scanner process to check objects against all configured lifecycle management rules. Slow scanning due to high IO workloads or limited system resources may delay application of lifecycle management rules. See Lifecycle Management Object Scanner for more information.

--noncurrentversion-transition-days

The number of days an object has been non-current (i.e. replaced by a newer version of that same object) after which MinIO marks the object version as eligible for transition. MinIO transitions the object to the configured remote storage tier specified to the --storage-class once the system host datetime passes that calendar date.

This option has no effect on non-versioned buckets.

This option has the same behavior as the S3 NoncurrentVersionTransition action.

MinIO uses a scanner process to check objects against all configured lifecycle management rules. Slow scanning due to high IO workloads or limited system resources may delay application of lifecycle management rules. See Lifecycle Management Object Scanner for more information.

--storage-class

The remote storage tier to which MinIO transition objects. Specify a remote storage tier created by mc admin tier.

If using mc ilm edit against an Amazon S3 service, this argument is the Amazon S3 storage class to transition objects covered by the rule. See Transition objects using Amazon S3 Lifecycle for more information on S3 storage classes.

--disable

Disables the rule.

mc ilm remove

Removes an existing lifecycle management rule from the bucket. The command has the following syntax:

 mc ilm remove [FLAGS] TARGET

The command supports the following arguments:

TARGET

Required The full path to the bucket from which to remove the specified lifecycle management rule. Specify the alias of a configured S3 service as the prefix to the TARGET path.

For example:

mc ilm remove [FLAGS] play/mybucket
id

Required

The unique ID of the rule. Use mc ilm list to list bucket rules and retrieve the id for the rule you want to remove.

Mutually exclusive with mc ilm remove --all

all

Required Removes all rules in the bucket. Mutually exclusive with mc ilm remove --id.

Requires including --force.

force

Required if specifying --all.

mc ilm export

Export the JSON-formatted lifecycle configuration to STDOUT. The command has the following syntax:

mc ilm export TARGET

The command supports the following arguments:

TARGET

Required The full path to the bucket from which to export the configured lifecycle management rules. Specify the alias of a configured S3 service as the prefix to the TARGET path. For example:

mc ilm export play/mybucket > play_mybucket_lifecycle_rules.json
mc ilm import

Import a JSON-formatted lifecycle configuration from STDIN. The command has the following syntax:

mc ilm import TARGET

The command supports the following arguments:

TARGET

Required The full path to the bucket from which to apply the imported lifecycle management rules. Specify the alias of a configured S3 service as the prefix to the TARGET path. For example:

mc ilm import play/mybucket < play_mybucket_lifecycle_rules.json