Adding lifecycle policies via built-in MinIO commands

Last change on 2026-09-29 • Created on 2026-09-18 • ID: ST-07749

To automatically delete objects after a set time period, you can use lifecycle policies. For more information about lifecycle policies, see the FAQ entry "What are lifecycle policies and how do I use them?".

The MinIO AIStor Client offers a built-in option that makes management of basic lifecycle policies more convinient than having to create and apply a lifecycle configuration file. This option will be explained below.

  1. Add rules:

    MinIO docs

    mc ilm rule add \
       --expire-days 90 \
       --noncurrent-expire-days 30 \
       <alias_name>/<bucket_name>

    The command above will enable the following deletions:

    Option Description
    Expiration: Days 90 days after an object was created, it is either permanently deleted (no versioning), or a delete marker is added (versioning enabled/suspended).
    NoncurrentVersionExpiration Note that our Object Storage only supports the option NoncurrentDays for this data type.

    30 days after an object became a "noncurrent version" (replaced by a newer version), it is permanently deleted — unless object lock is applied.

  1. Add a delete marker:

    MinIO docs

    mc ilm rule add \
       --expire-delete-marker \
       <alias_name>/<bucket_name>

    The command above will add the following:

    Option Description
    ExpiredObjectDeleteMarker If a delete marker is the only remaining version of an object and all noncurrent versions have been permanently deleted, the delete marker is also deleted.

  1. View the lifecycle rules:

    MinIO docs

    mc ilm rule ls <alias_name>/<bucket_name>

  1. Remove the lifecycle rules:

    MinIO docs

    mc ilm rule rm --id "expiry" <alias_name>/<bucket_name>
    mc ilm rule rm --all --force <alias_name>/<bucket_name>

As long as the lifecycle rules are enabled, your objects will get deleted automatically.


Next: