Amazon Simple Storage Service
Developer Guide (API Version 2006-03-01)
Did this page help you?  Yes | No |  Tell us about it...
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.

Object Lifecycle Management


What Is Lifecycle Configuration?

You manage an object's lifecycle by using a lifecycle configuration, which defines how Amazon S3 manages objects during their lifetime, from creation/initial storage to when the object is deleted or overwritten. Amazon S3 provides a number of ways to simplify the lifecycle management of your objects, including automated archival to lower cost storage in Amazon Glacier and scheduled deletions.

You can define lifecycle configuration rules for objects that have a well-defined lifecycle. Many objects that you store in an Amazon S3 bucket might have a well-defined lifecycle, for example:

  • If you are uploading periodic logs to your bucket, your application might need these logs for a week or a month after creation, and after that you might want to delete them.

  • Some documents are frequently accessed for a limited period of time. After that, you might not need real-time access to these objects, but your organization might require you to archive them for a longer period and then optionally delete them later. Some types of data that you might upload to Amazon S3 primarily for archival purposes include digital media archives, financial and healthcare records, raw genomics sequence data, long-term database backups, and data that must be retained for regulatory compliance.

How Do I Configure a Lifecycle?

A lifecycle configuration comprises a set of rules with predefined actions that you want Amazon S3 to perform on objects during their lifetime. You can specify a lifecycle configuration as XML. Amazon S3 stores the configuration as a "lifecycle" subresource attached to your bucket. Using the Amazon S3 API, you can Put, Get, or Delete a lifecycle configuration. Unless you need to make the REST API calls directly from your application, you can also configure the lifecycle by using the Amazon S3 console or programmatically by using the AWS SDK wrapper libraries.

Lifecycle Support for Versioning

You can add lifecycle configuration to nonversioned buckets and versioning-enabled buckets. By default a bucket is nonversioned and you can optionally enable versioning. A versioning-enabled bucket maintains one current and zero or more noncurrent object versions. You can use versioning and lifecycle rules together to help manage the storage costs of your objects. Using the predefined lifecycle configuration actions, you can manage lifecycle of both current and noncurrent object versions.

  • The Transition and Expiration lifecycle actions enable you to manage the lifecycle of current versions of your objects.

  • The NonCurrentVersionTransition and NonCurrentVersionExpiration actions enable you to manage the lifecycle of noncurrent (previous) versions of your objects.

For more information about these actions, see Lifecycle Configuration Elements. For information about versioning, see Object Versioning.

General Considerations

About Archiving Objects

Using lifecycle configuration, you can transition objects to the GLACIER storage class—that is, archive data to Amazon Glacier, a lower-cost storage solution. Before you archive objects, note the following:

  • Objects in the GLACIER storage class are not available in real time.

    Archived objects are Amazon S3 objects, but before you can access an archived object, you must first restore a temporary copy of it. The restored object copy is available only for the duration you specify in the restore request. After that, Amazon S3 deletes the temporary copy, and the object remains archived in Amazon Glacier.

    Note that object restoration from an archive can take up to five hours.

    You can restore an object by using the Amazon S3 console or programmatically by using the AWS SDKs wrapper libraries or the Amazon S3 REST API (see POST Object restore) in your code.

  • The transition of objects to the GLACIER storage class is one-way.

    You cannot use a lifecycle configuration rule to convert the storage class of an object from GLACIER to Standard or RRS. If you want to change the storage class of an already archived object to either Standard or RRS, you must use the restore operation to make a temporary copy first. Then use the copy operation to overwrite the object as a Standard or RRS object.

  • GLACIER storage class objects are visible and available only through Amazon S3, not through Amazon Glacier.

    Amazon S3 stores the archived objects in Amazon Glacier; however, these are Amazon S3 objects, and you can access them only by using the Amazon S3 console or the API. You cannot access the archived objects through the Amazon Glacier console or the API.

For more information about lifecycle configuration, see the following topics:

Lifecycle Configuration and MFA Enabled Buckets

Lifecycle configuration on MFA-enable buckets is not supported.