Yandex Cloud
  • Services
  • Solutions
  • Why Yandex Cloud
  • Pricing
  • Documentation
  • Contact us
Get started
Language / Region
© 2022 Yandex.Cloud LLC
Yandex Object Storage
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Buckets
      • Creating a bucket
      • Deleting a bucket
      • Limiting the maximum size of a bucket
      • Allowing public access to a bucket
      • Bucket encryption
      • Managing object lifecycles
      • Managing CORS configurations
      • Managing bucket policies
      • Managing bucket versioning
      • Editing a bucket ACL
      • Enabling logging
    • Objects
      • Uploading an object
      • Getting information about an object
      • Downloading an object
      • Getting a public link to an object
      • Deleting an object
      • Deleting all objects
      • Deleting a partially uploaded object
      • Editing an object ACL
    • Static website hosting
      • Hosting setup
      • Support for your own domain
      • Support for multiple domain names
      • Configuring HTTPS
    • Access management
      • Applying an access policy
  • Practical guidelines
    • Getting object query statistics with S3 Select
    • Getting website traffic statistics with S3 Select
    • Generating a billing report with resource break-down using S3 Select
    • Server-side encryption
    • Integrating an L7 load balancer with the CDN and Object Storage
    • Blue-green and canary deployment
    • Analyzing logs in DataLens
  • Concepts
    • Overview
    • Bucket
    • Objects
    • Bucket versioning
    • Object lifecycles
    • CORS
    • Static website hosting
    • Pre-signed URLs
    • Multipart upload
    • Access control lists (ACLs)
    • Bucket Policy
    • Uploading files via an HTML form
    • Storage class
    • Logging actions with a bucket
    • Backups
    • TLS protocol
    • S3 Select query language
    • Quotas and limits
  • Tools
    • All tools
    • Console clients
      • AWS CLI
      • S3cmd
    • File browsers
      • CyberDuck
      • WinSCP
    • SDK
      • AWS SDK for Java
      • Python SDK (boto)
      • The AWS SDK for .NET
      • AWS SDK for C++
      • AWS SDK for PHP
      • AWS SDK for Go
    • FUSE
      • GeeseFS
      • s3fs
      • goofys
    • FTP
      • Docker container for (S)FTP(S)
  • API reference
    • REST (Amazon S3-compatible)
      • How to use the API
      • Signing requests
      • API reference
        • All services and methods
        • Bucket
          • All methods
          • create
          • getBucketEncryption
          • getMeta
          • listObjects
          • listBuckets
          • deleteBucket
          • deleteBucketEncryption
          • putBucketEncryption
          • putBucketVersioning
          • getBucketVersioning
          • putBucketLogging
          • getBucketLogging
          • listObjectVersions
        • Object
          • All methods
          • upload
          • get
          • copy
          • getObjectMeta
          • delete
          • deleteMultipleObjects
          • options
          • selectObjectContent
        • Multipart upload
          • General multipart upload procedure
          • startUpload
          • uploadPart
          • copyPart
          • listParts
          • abortUpload
          • completeUpload
          • listUploads
        • Static Website Hosting
          • All methods
          • upload
          • get
          • delete
          • Static website response codes
        • CORS
          • All methods
          • XML structure of CORS configuration
          • upload
          • get
          • delete
        • Lifecycles
          • All methods
          • XML structure of lifecycle configuration
          • upload
          • get
          • delete
        • ACL
          • All methods
          • XML structure of ACL configuration
          • objectGetAcl
          • objectPutAcl
          • bucketGetAcl
          • bucketPutAcl
        • Bucket Policy
          • All methods
          • GetBucketPolicy
          • PutBucketPolicy
          • DeleteBucketPolicy
          • Data schema
          • Actions
          • Conditions
        • Common request headers
        • Common response headers
        • Responses
    • gRPC and REST
      • Authentication in the API
      • gRPC
        • Overview
        • BucketService
        • OperationService
      • REST
        • Overview
        • Bucket
          • Overview
          • create
          • delete
          • deleteHTTPSConfig
          • get
          • getHTTPSConfig
          • getStats
          • list
          • setHTTPSConfig
          • update
  • Access management
  • Pricing policy
    • Current pricing policy
    • Archive
      • Before January 1, 2019
      • From January 1 to March 1, 2019
  • Questions and answers
  1. API reference
  2. REST (Amazon S3-compatible)
  3. API reference
  4. Lifecycles
  5. XML structure of lifecycle configuration

Bucket object lifecycle configuration

Written by
Yandex Cloud
  • Elements
  • Example

Object Storage lets you manage lifecycles for objects in buckets. To upload the lifecycle configuration to Object Storage, you need to create an XML document as described in this section. You can obtain a document in this format by downloading an existing configuration.

General configuration format:

<LifecycleConfiguration>
    <Rule>
        <ID>Rule description</ID>
        <Status>{Enabled|Disabled}</Status>
        <Filter>
           <Prefix>key_ prefix</Prefix>
        </Filter>

        <Transition>
            <StorageClass>Storage class ID</StorageClass>
            <!-- <Date> or <Days> -->
        </Transition>

        <Expiration>
            <!-- <Date> or <Days> -->
            <!-- <ExpiredObjectDeleteMarker> -->
        </Expiration>

        <NoncurrentVersionTransition>
            <StorageClass>Storage class ID</StorageClass>
            <NoncurrentDays>Migrating versions that are older than the specified number of days</NoncurrentDays>
        </NoncurrentVersionTransition>

        <NoncurrentVersionExpiration>
            <NoncurrentDays>Deleting versions that are older than the specified number of days</NoncurrentDays>
        </NoncurrentVersionExpiration>

        <AbortIncompleteMultipartUpload>
            <DaysAfterInitiation>Deleting uploads that were not completed within the specified number of days</DaysAfterInitiation>
        </AbortIncompleteMultipartUpload>
        ...
    </Rule>
    <Rule>
      ...
    </Rule>
    ...
</LifecycleConfiguration>

A configuration may contain up to 1000 rules.

Elements

Element Description
AbortIncompleteMultipartUpload Rule for deleting uploads not completed within the specified number of days.

Contains the DaysAfterInitiation element that sets when the rule applies.

Path: LifecycleConfiguration\Rule\AbortIncompleteMultipartUpload\DaysAfterInitiation.
Date Date of rule execution.

Format: ISO 8601, for example, YYYY-MM-DD. Time is always 00:00 UTC.

Path: LifecycleConfiguration\Rule\Expiration\Date.
Days Rule execution interval.

This is defined by the number of days since the object was uploaded.

Path: LifecycleConfiguration\Rule\Expiration\Days.
Expiration Rule for deleting an object from Object Storage.

Contains the Days or Date element that sets the action expiry.
It may also contain ExpiredObjectDeleteMarker: An expired object delete marker that indicates whether Object Storage will remove the delete marker if there aren't any non-current versions.

Path: LifecycleConfiguration\Rule\Expiration.
Filter Object filter.

Contains no more than one Prefix element. If an empty <Filter></Filter> filter is set, the rule applies to all objects in a bucket.

Path: LifecycleConfiguration\Rule\Filter.
ID Unique rule ID.

Custom text up to 255 characters long, such as "Delete in 20 days". An optional parameter that you can use to search for a rule in a configuration.

If no ID is specified, Object Storage generates one automatically.

Path: LifecycleConfiguration\Rule\ID.
LifecycleConfiguration Root element of an XML document.

It may contain up to 1000 Rule elements.

Path: LifecycleConfiguration.
Prefix Key prefix.

You can use it to filter objects that meet the rule.

Examples of prefixes for the key some/long/object/key: some, some/, some/lo.

Filters can only contain one prefix.

Path: LifecycleConfiguration\Rule\Filter\Prefix.
Rule Rule description.

Objects that meet the rule are set by the Filter element. Actions on objects are defined by the Transition and Expiration elements. There can be multiple actions of each type.

Path: LifecycleConfiguration\Rule.
Status Rule status.

You can activate a rule by setting <Status>Enabled</Status> for it, or disable it by setting <Status>Disabled</Status>.

Path: LifecycleConfiguration\Rule\Status.
StorageClass Storage class of an object.

Path: LifecycleConfiguration\Rule\Transition\StorageClass.
Transition The rule to change the storage class of an object.

It contains the StorageClass element, which defines the target storage class and the Date or Days element, which sets when the action expires.

You can only move objects from standard to cold storage.

Path: LifecycleConfiguration\Rule\Transition\.
NoncurrentVersionTransition The rule to change the storage class for non-current object versions. This rule only applies to non-current versions of an object rather than the entire object.

Contains the StorageClass element that sets the target storage class and the NoncurrentDays element that sets the action expiry.

You can only move objects from standard to cold storage.

Path: LifecycleConfiguration\Rule\NoncurrentVersionTransition.
NoncurrentVersionExpiration Rule for deleting non-current object versions from Object Storage. This rule only applies to non-current versions of an object rather than the entire object.

Contains the NoncurrentDays element that sets the action expiry.

Path: LifecycleConfiguration\Rule\NoncurrentVersionExpiration.

Example

The rule below applies to all objects uploaded to the bucket as follows:

  • They are moved to cold storage 30 days after being uploaded to Object Storage.
  • They are deleted from Object Storage 365 days after being uploaded.
  • Deleting incomplete uploads from Object Storage 5 days after the start of the object upload.
<LifecycleConfiguration>
    <Rule>
        <ID>Move and then delete</ID>
        <Status>Enabled</Status>
        <Filter>
           <Prefix></Prefix>
        </Filter>
        <Transition>
            <StorageClass>COLD</StorageClass>
            <Days>30</Days>
        </Transition>
        <Expiration>
            <Days>365</Days>
        </Expiration>
        <AbortIncompleteMultipartUpload>
            <DaysAfterInitiation>5</DaysAfterInitiation>
        </AbortIncompleteMultipartUpload>
    </Rule>
</LifecycleConfiguration>

Was the article helpful?

Language / Region
© 2022 Yandex.Cloud LLC
In this article:
  • Elements
  • Example