Menu
Amazon Simple Storage Service
API Reference (API Version 2006-03-01)

GET Bucket lifecycle

Description

Note

Bucket lifecycle configuration now supports specifying lifecycle rule using object key name prefix, one or more object tags, or combination of both. Accordingly, this section describes the latest API. The response describes the new filter element that you can use to specify a filter to select a subset of objects to which the rule applies. If you are still using previous version of the lifecycle configuration, it works. For related API description, see GET Bucket lifecycle (deprecated).

Returns the lifecycle configuration information set on the bucket. For information about lifecycle configuration, go to Object Lifecycle Management in the Amazon Simple Storage Service Developer Guide.

To use this operation, you must have permission to perform the s3:GetLifecycleConfiguration action. The bucket owner has this permission, by default. The bucket owner can grant this permission to others. For more information about permissions, see Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple Storage Service Developer Guide.

Requests

Syntax

GET /?lifecycle HTTP/1.1
Host: bucketname.s3.amazonaws.com
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
		4))

Request Parameters

This implementation of the operation does not use request parameters.

Request Headers

This implementation of the operation uses only request headers that are common to all operations. For more information, see Common Request Headers.

Request Elements

This implementation of the operation does not use request elements.

Responses

Response Headers

This implementation of the operation uses only response headers that are common to most responses. For more information, see Common Response Headers.

Response Elements

This implementation of GET returns the following response elements.

Name Description
And Container for specifying Prefix and Tag based filters.

Child: Prefix and Tag

Type: Container

Ancestor: Filter.

AbortIncompleteMultipartUpload Container for specifying when an incomplete multipart upload becomes eligible for an abort operation.

Child: DaysAfterInitiation

Type: Container

Ancestor: Rule.

Date Object creation date based on which the object is deemed eligible for lifecycle action. For example, suppose you add a Transition action to take effect on December 31, 2014. S3 will take this action on applicable objects created on or before this date.

Type: String

Ancestor: Expiration or Transition

Days

Specifies the number of days after object creation when the specific rule action takes effect. The object's eligibility time is calculated as creation time + the number of days, and rounding the resulting time to the next day midnight UTC.

Type: Non-negative Integer when used with Transition, Positive Integer when used with Expiration.

Ancestor: Transition or Expiration.

DaysAfterInitiation

Specifies the number of days after initiating a multipart upload when the multipart upload must be completed. If it does not complete by the specified number of days, it becomes eligible for an abort operation and Amazon S3 aborts the incomplete multipart upload.

Type: Positive Integer.

Ancestor: AbortIncompleteMultipartUpload.

Expiration

This action specifies a period in the object's lifetime when Amazon S3 should take the appropriate expiration action. The expiration action occurs only on objects that are eligible according to the period specified in the child Date or Days element. The action Amazon S3 takes depends on whether the bucket is versioning enabled.

  • If versioning has never been enabled on the bucket, Amazon S3 deletes the only copy of the object permanently.

  • Otherwise, if your bucket is versioning-enabled (or versioning is suspended), the action applies only to the current version of the object. Buckets with versioning-enabled or versioning-suspended can have many versions of the same object, one current version, and zero or more noncurrent versions.

    Instead of deleting the current version, Amazon S3 makes it a noncurrent version by adding a delete marker as the new current version.

    Important

    If your bucket state is versioning-suspended, Amazon S3 creates a delete marker with version ID null. If you have a version with version ID null, then Amazon S3 overwrites that version.

    Note

    To set expiration for noncurrent objects, you must use the NoncurrentVersionExpiration action.

Type: Container

Children: Days or Date

Ancestor: Rule

Filter

Container element describing one or more filters used to identify a subset of objects to which the lifecycle rule applies.

Child: Prefix, Tag, or And (if both prefix and tag are specified)

Type: String

Ancestor: Rule

ID

Unique identifier for the rule. The value cannot be longer than 255 characters.

Type: String

Ancestor: Rule

Key

Tag key.

Type: String

Ancestor: Tag

LifecycleConfiguration

Container for lifecycle rules. You can add as many as 1000 rules.

Type: Container

Children: Rule

Ancestor: None

ExpiredObjectDeleteMarker

On a versioned bucket (versioning-enabled or versioning-suspended bucket) this element indicates if Amazon S3 will delete any expired object delete markers in the bucket. For an example, go to Example 8: Specify Expiration Action to Remove Expired Object Delete Markers in the Amazon Simple Storage Service Developer Guide.

Type: String

Valid values: true | false (the value false is allowed but it is no-op, Amazon S3 will not take action if the value is false)

Ancestor: Expiration.

NoncurrentDays

Specifies the number of days an object is noncurrent before Amazon S3 can perform the associated action. For information about the noncurrent days calculations, see Lifecycle Rules Based on the Number of Days in the Amazon Simple Storage Service Developer Guide.

Type: Nonnegative Integer when used with NoncurrentVersionTransition, Positive Integer when used with NoncurrentVersionExpiration.

Ancestor: NoncurrentVersionExpiration or NoncurrentVersionTransition

NoncurrentVersionExpiration

Specifies when noncurrent object versions expire. Upon expiration, Amazon S3 permanently deletes the noncurrent object versions.

You set this lifecycle configuration action on a bucket that has versioning enabled (or suspended) to request that Amazon S3 delete noncurrent object versions at a specific period in the object's lifetime.

Type: Container

Children: NoncurrentDays

Ancestor: Rule

NoncurrentVersionTransition

Container for the transition rule that describes when noncurrent objects transition to the STANDARD_IA or the GLACIER storage class.

If your bucket is versioning-enabled (or versioning is suspended), you can set this action to request Amazon S3 to transition noncurrent object versions to the GLACIER storage class at a specific period in the object's lifetime.

Type: Container

Children: NoncurrentDays and StorageClass

Ancestor: Rule

Prefix

Object key prefix identifying one or more objects to which the rule applies.

Type: String

Ancestor: Filter or And (if you specify Prefix and Tag child elements in the Filter)

Rule

Container for a lifecycle rule.

Type: Container

Ancestor: LifecycleConfiguration

Status

If Enabled, Amazon S3 executes the rule as scheduled. If Disabled, Amazon S3 ignores the rule.

Type: String

Ancestor: Rule

Valid values: Enabled or Disabled.

StorageClass

Specifies the Amazon S3 storage class to which you want to transition the object.

Type: String

Ancestor: Transition and NoncurrentVersionTransition

Valid values: STANDARD_IA | GLACIER.

Tag

Container listing the tag key and value used to filter objects to which the rule applies.

Type: String

Ancestor: Filter

Transition

This action specifies a period in the objects' lifetime when Amazon S3 should transition them to the STANDARD_IA or the GLACIER storage class. When this action is in effect, what Amazon S3 does depends on whether the bucket is versioning-enabled.

  • If versioning has never been enabled on the bucket, Amazon S3 transitions the only copy of the object specified storage class.

  • Otherwise, when your bucket is versioning-enabled (or versioning is suspended), Amazon S3 transitions only the current versions of objects identified in the rule.

    Note

    A versioning-enabled or versioning-suspended bucket can have many versions of an object. This action has no impact on the noncurrent object versions. To transition noncurrent objects, you must use the NoncurrentVersionTransition action.

Type: Container

Children: Days or Date, and StorageClass

Ancestor: Rule

Value

Tag key value.

Type: String

Ancestor: Tag

Special Errors

Error CodeDescriptionHTTP Status CodeSOAP Fault Code Prefix
NoSuchLifecycleConfigurationThe lifecycle configuration does not exist. 404 Not FoundClient

For general information about Amazon S3 errors and a list of error codes, see Error Responses.

Examples

Example 1: Retrieve lifecycle subresource

This example shows a GET request to retrieve the lifecycle subresource from the specified bucket and an example response with the returned lifecycle configuration.

Sample Request

GET /?lifecycle HTTP/1.1
Host: examplebucket.s3.amazonaws.com
x-amz-date: Thu, 15 Nov 2012 00:17:21 GMT
Authorization: signatureValue

Sample Response

HTTP/1.1 200 OK
x-amz-id-2: ITnGT1y4RyTmXa3rPi4hklTXouTf0hccUjo0iCPjz6FnfIutBj3M7fPGlWO2SEWp
x-amz-request-id: 51991C342C575321
Date: Thu, 15 Nov 2012 00:17:23 GMT
Server: AmazonS3
Content-Length: 358

<?xml version="1.0" encoding="UTF-8"?>
<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <Rule>
        <ID>Archive and then delete rule</ID>
        <Filter>
           <Prefix>projectdocs/</Prefix>
        </Filter>
        <Status>Enabled</Status>
       <Transition>
           <Days>30</Days>
           <StorageClass>STANDARD_IA</StorageClass>
        </Transition>
        <Transition>
           <Days>365</Days>
           <StorageClass>GLACIER</StorageClass>
        </Transition>
        <Expiration>
           <Days>3650</Days>
        </Expiration>
    </Rule>
</LifecycleConfiguration>