GetBucketLifecycle
For an updated version of this API, see GetBucketLifecycleConfiguration. If you configured a bucket lifecycle using the filter
element, you should use the updated version. This topic is provided for backward compatibility.
Returns the lifecycle configuration information set on the bucket.
Description
The GetBucketLifecycle
operation returns the lifecycle configuration information set on the bucket. To use this operation, you must have s3:GetLifecycleConfiguration
permissions on the bucket, or be the bucket owner.
- If the bucket doesn't have a lifecycle configuration, this operation returns an empty
LifecycleConfiguration
element. - This operation is not supported for directory buckets.
Request Syntax
This operation does not have a request body.
Request Parameters
Headers
Name | Description | Required | Type |
---|---|---|---|
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). | No | text |
Examples
Example 1: Get lifecycle configuration from a bucket
Response Syntax
Response Elements
Response Headers
Name | Description | Required | Type |
---|---|---|---|
x-amz-id-2 | An identifier for the request | No | String |
x-amz-request-id | A unique identifier for the request | No | String |
Date | The date and time at which the response was sent | No | String |
Response Body Elements
Name | Description | Required | Type |
---|---|---|---|
LifecycleConfiguration | Container for the bucket's lifecycle rules | Yes | Container |
Rule | Container for a lifecycle rule. The bucket can have zero or more lifecycle rules. | Yes | Rule |
For details about the elements within the Rule type, see Rule. The response format follows the AWS S3 GetBucketLifecycle API specification.
Special Errors
Error Code | Description |
---|---|
NoSuchBucket | The specified bucket does not exist |
NoSuchLifecycleConfiguration | The lifecycle configuration does not exist |
403 | Forbidden. Authentication failed or you do not have permission to access the bucket lifecycle configuration |
Permissions
You must have the s3:GetLifecycleConfiguration
permission.
Try It Out
Test GetBucketLifecycle
Get the lifecycle configuration of a bucket.
Coming Soon
This feature is currently under development and will be available soon.