Lifecycle Configuration Reference

A lifecycle configuration is a JSON file in which you define the rules you want to apply to the objects of a bucket. With a lifecycle configuration, you can apply an expiration date to the objects stored in a bucket.

This page describes the elements you can specify in a lifecycle configuration file. Once you have written the file, you need to apply it to your bucket. For more information, see Applying a Lifecycle Configuration to Your Objects.

A delay is to be expected during object deletion.

This feature is not available from Cockpit. This documentation only describes the procedure using AWS CLI.

To create a lifecycle configuration, you need to create a JSON file following this structure:

Configuration structure
{
   "Rules": [
      {
         "ID": "string",
         "Status": "Enabled",
         "Expiration": {
            "Days": integer,
            "ExpiredObjectDeleteMarker": false
         },
         "NoncurrentVersionExpiration": {
            "NoncurrentDays": integer
         },
         "AbortIncompleteMultipartUpload": {
            "DaysAfterInitiation": integer
         },
         "Filter": {
            "And": {
               "Prefix": "string",
               "Tags": [
                  {
                     "Key": "test",
                     "Value": "test"
                  }
               ]
            }
         }
      }
   ]
}

This file contains the following attributes:

Attribute Required Description

Rules

Yes

One or more rules in the lifecycle configuration.

The order in which you specify the rules is not significant.

ID

No

A unique name for the rule.

The ID cannot be longer than 255 characters.

Status

Yes

If Enabled, the rule is applied. If Disabled, the rule is not applied.

Expiration

No

Specifies the expiration date for the objects.

Days

No

The lifetime of the objects, in days.

ExpiredObjectDeleteMarker

No

If true, the expired delete markers of the objects are deleted.

This rule is not compatible with the Days rule.

NoncurrentVersionExpiration

No

Specifies the expiration of noncurrent versions of your objects. For more information, see Enabling or Disabling Bucket Versioning.

NoncurrentDays

No

The lifetime, in days, of noncurrent objects.

AbortIncompleteMultipartUpload

No

Specifies when an incomplete multipart upload is aborted. For more information, see Using Multipart Upload.

DaysAfterInitiation

No

The number of days after which an incomplete multipart upload is aborted.

Filter

Yes

Specifies the objects the rule applies to.

The objects are identified with a prefix and/or one or more tags.

  • To have no filtering, use an empty filter:

         "Filter": {}
  • To filter with a prefix, use the following structure:

         "Filter": {
            "Prefix": "string"
         }
  • To filter with one or more tags, use the following structure, with an empty Prefix string:

         "Filter": {
            "And": {
               "Prefix": "",
               "Tags": [
                  {
                     "Key": "test",
                     "Value": "test"
                  }
               ]
            }
         }
  • To filter with a prefix and one or more tags, use the following structure:

         "Filter": {
            "And": {
               "Prefix": "string",
               "Tags": [
                  {
                     "Key": "test",
                     "Value": "test"
                  }
               ]
            }
         }

If a lifecycle rule uses tag filtering, you will not be able to define the ExpiredObjectDeleteMarker and AbortIncompleteMultipartUpload rules.

Related Pages

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.