GET Bucket lifecycle
Description
Note
Bucket lifecycle configuration now supports specifying a lifecycle rule using an object key name prefix, one or more object tags, or a 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:dateAuthorization: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: Type: Container Ancestor:
|
AbortIncompleteMultipartUpload
|
Container for specifying when an incomplete multipart upload becomes eligible for
an
abort operation.
Child:
Type: Container Ancestor: |
Date
|
Date when you want Amazon S3 to take the action. For more information, see Lifecycle Rules: Based on a Specific Date in the
Amazon Simple Storage Service Developer Guide.
Type: String Ancestor: |
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 Ancestor: |
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: |
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
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: 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 (a versioning-enabled or versioning-suspended bucket), this element indicates whether 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, which means that Amazon S3 does not take action if the value is false) Ancestor: |
NoncurrentDays
|
Specifies the number of days that an object is noncurrent before Amazon S3 can perform the associated action. For information about calculating noncurrent days, see Lifecycle Rules Based on the Number of Days in the Amazon Simple Storage Service Developer Guide. Type: Nonnegative Integer when used with Ancestor: |
NoncurrentVersionExpiration
|
Specifies when noncurrent object versions expire. Upon expiration, Amazon S3 permanently deletes the noncurrent object versions. 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 If your bucket is versioning-enabled (or versioning is suspended), you can set this action to request that Amazon S3 transition noncurrent object versions 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: |
Rule
|
Container for a lifecycle rule. Type: Container Ancestor: LifecycleConfiguration |
Status
|
If enabled, Amazon S3 executes the rule as scheduled. If it is 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:
|
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
Type: Container Children: Days or Date, and StorageClass Ancestor: Rule |
Value
|
Tag key value. Type: String Ancestor: Tag |
Special Errors
| Error Code | Description | HTTP Status Code | SOAP Fault Code Prefix |
|---|---|---|---|
NoSuchLifecycleConfiguration |
The lifecycle configuration does not exist. | 404 Not Found | Client |
For general information about Amazon S3 errors and a list of error codes, see Error Responses.
Examples
Example 1: Retrieve the Lifecycle Subresource
This example is a GET request to retrieve the lifecycle subresource from the
specified bucket. The example response returns the 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>


