GetBucketLifecycleConfiguration
Note
This operation is not supported by directory buckets.
Note
Bucket lifecycle configuration now supports specifying a lifecycle rule using an object key name prefix, one or more object tags, object size, or any combination of these. Accordingly, this section describes the latest API. The previous version of the API supported filtering based only on an object key name prefix, which is supported for backward compatibility. For the related API description, see GetBucketLifecycle. 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 using a previous version of the lifecycle configuration, it still works. For the earlier action,
Returns the lifecycle configuration information set on the bucket. For information about lifecycle configuration, see Object Lifecycle Management.
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 Permissions Related to Bucket Subresource Operations and Managing
Access Permissions to Your Amazon S3 Resources.
GetBucketLifecycleConfiguration
has the following special error:
-
Error code:
NoSuchLifecycleConfiguration
-
Description: The lifecycle configuration does not exist.
-
HTTP Status Code: 404 Not Found
-
SOAP Fault Code Prefix: Client
-
The following operations are related to
GetBucketLifecycleConfiguration
:
Request Syntax
GET /?lifecycle HTTP/1.1
Host: Bucket
.s3.amazonaws.com
x-amz-expected-bucket-owner: ExpectedBucketOwner
URI Request Parameters
The request uses the following URI parameters.
- Bucket
-
The name of the bucket for which to get the lifecycle information.
Required: Yes
- x-amz-expected-bucket-owner
-
The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code
403 Forbidden
(access denied).
Request Body
The request does not have a request body.
Response Syntax
HTTP/1.1 200
x-amz-transition-default-minimum-object-size: TransitionDefaultMinimumObjectSize
<?xml version="1.0" encoding="UTF-8"?>
<LifecycleConfiguration>
<Rule>
<AbortIncompleteMultipartUpload>
<DaysAfterInitiation>integer</DaysAfterInitiation>
</AbortIncompleteMultipartUpload>
<Expiration>
<Date>timestamp</Date>
<Days>integer</Days>
<ExpiredObjectDeleteMarker>boolean</ExpiredObjectDeleteMarker>
</Expiration>
<Filter>
<And>
<ObjectSizeGreaterThan>long</ObjectSizeGreaterThan>
<ObjectSizeLessThan>long</ObjectSizeLessThan>
<Prefix>string</Prefix>
<Tag>
<Key>string</Key>
<Value>string</Value>
</Tag>
...
</And>
<ObjectSizeGreaterThan>long</ObjectSizeGreaterThan>
<ObjectSizeLessThan>long</ObjectSizeLessThan>
<Prefix>string</Prefix>
<Tag>
<Key>string</Key>
<Value>string</Value>
</Tag>
</Filter>
<ID>string</ID>
<NoncurrentVersionExpiration>
<NewerNoncurrentVersions>integer</NewerNoncurrentVersions>
<NoncurrentDays>integer</NoncurrentDays>
</NoncurrentVersionExpiration>
<NoncurrentVersionTransition>
<NewerNoncurrentVersions>integer</NewerNoncurrentVersions>
<NoncurrentDays>integer</NoncurrentDays>
<StorageClass>string</StorageClass>
</NoncurrentVersionTransition>
...
<Prefix>string</Prefix>
<Status>string</Status>
<Transition>
<Date>timestamp</Date>
<Days>integer</Days>
<StorageClass>string</StorageClass>
</Transition>
...
</Rule>
...
</LifecycleConfiguration>
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The response returns the following HTTP headers.
- x-amz-transition-default-minimum-object-size
-
Indicates which default minimum object size behavior is applied to the lifecycle configuration.
-
all_storage_classes_128K
- Objects smaller than 128 KB will not transition to any storage class by default. -
varies_by_storage_class
- Objects smaller than 128 KB will transition to Glacier Flexible Retrieval or Glacier Deep Archive storage classes. By default, all other storage classes will prevent transitions smaller than 128 KB.
To customize the minimum object size for any transition you can add a filter that specifies a custom
ObjectSizeGreaterThan
orObjectSizeLessThan
in the body of your transition rule. Custom filters always take precedence over the default transition behavior.Valid Values:
varies_by_storage_class | all_storage_classes_128K
-
The following data is returned in XML format by the service.
- LifecycleConfiguration
-
Root level tag for the LifecycleConfiguration parameters.
Required: Yes
- Rule
-
Container for a lifecycle rule.
Type: Array of LifecycleRule data types
Examples
Sample Request
This example illustrates one usage of GetBucketLifecycleConfiguration.
GET /?lifecycle HTTP/1.1 Host: examplebucket.s3.<Region>.amazonaws.com x-amz-date: Thu, 15 Nov 2012 00:17:21 GMT Authorization: signatureValue
Sample Response
This example illustrates one usage of GetBucketLifecycleConfiguration.
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> <Prefix>projectdocs/</Prefix> <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>
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: