Service: Amazon S3
NoteBucket 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 using a previous version of the lifecycle configuration, it still works. For the earlier action, see GetBucketLifecycle.
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:
• GetBucketLifecycle
• PutBucketLifecycle
• DeleteBucketLifecycle
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 (p. 121)
The name of the bucket for which to get the lifecycle information.
Required: Yes
x-amz-expected-bucket-owner (p. 121)
The account ID of the expected bucket owner. If the bucket is owned by a different account, 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
<?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>
<ObjectSizeGreaterThan>long</ObjectSizeGreaterThan>
<ObjectSizeLessThan>long</ObjectSizeLessThan>
<Prefix>string</Prefix>
<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>
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in XML format by the service.
LifecycleConfiguration (p. 122)
Root level tag for the LifecycleConfiguration parameters.
Required: Yes Rule (p. 122)
Container for a lifecycle rule.
Type: Array of LifecycleRule (p. 699) data types
Examples
Sample Request
This example illustrates one usage of GetBucketLifecycleConfiguration.
GET /?lifecycle HTTP/1.1
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>
For more information about using this API in one of the language-specific AWS SDKs, see the following:
• AWS Command Line Interface
• AWS SDK for .NET
• AWS SDK for C++
• AWS SDK for Go
• AWS SDK for Java V2
• AWS SDK for JavaScript
• AWS SDK for PHP V3
• AWS SDK for Python
• AWS SDK for Ruby V3
GetBucketLocation
Service: Amazon S3
Returns the Region the bucket resides in. You set the bucket's Region using the LocationConstraint request parameter in a CreateBucket request. For more information, see CreateBucket.
To use this implementation of the operation, you must be the bucket owner.
To use this API against an access point, provide the alias of the access point in place of the bucket name.
The following operations are related to GetBucketLocation:
• GetObject
• CreateBucket
Request Syntax
GET /?location 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 (p. 125)
The name of the bucket for which to get the location.
Required: Yes
x-amz-expected-bucket-owner (p. 125)
The account ID of the expected bucket owner. If the bucket is owned by a different account, 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
<?xml version="1.0" encoding="UTF-8"?>
<LocationConstraint>
<LocationConstraint>string</LocationConstraint>
</LocationConstraint>
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in XML format by the service.
LocationConstraint (p. 125)
Root level tag for the LocationConstraint parameters.
Required: Yes
LocationConstraint (p. 125)
Specifies the Region where the bucket resides. For a list of all the Amazon S3 supported location constraints by Region, see Regions and Endpoints. Buckets in Region us-east-1 have a
LocationConstraint of null.
Type: String
Valid Values: af-south-1 | east-1 | northeast-1 | northeast-2 | ap-northeast-3 | ap-south-1 | ap-southeast-1 | ap-southeast-2 | ca-central-1 | cn-north-1 | cn-northwest-1 | EU | eu-central-1 | eu-north-1 | eu-south-1 | eu-west-1 | eu-west-2 | eu-west-3 | me-south-1 | sa-east-1 | east-2 | us-gov-east-1 | us-gov-west-1 | us-west-1 | us-west-2
Examples
Sample Request
The following request returns the Region of the specified bucket.
GET /?location HTTP/1.1
Host: myBucket.s3.amazonaws.com Date: Tue, 09 Oct 2007 20:26:04 +0000 Authorization: signatureValue
Sample Response
This example illustrates one usage of GetBucketLocation.
<?xml version="1.0" encoding="UTF-8"?>
<LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/">Europe</
LocationConstraint>
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
• AWS Command Line Interface
• AWS SDK for .NET
• AWS SDK for C++
• AWS SDK for Go
• AWS SDK for Java V2
• AWS SDK for JavaScript
• AWS SDK for PHP V3
• AWS SDK for Python
• AWS SDK for Ruby V3
GetBucketLogging
Service: Amazon S3
Returns the logging status of a bucket and the permissions users have to view and modify that status. To use GET, you must be the bucket owner.
The following operations are related to GetBucketLogging:
• CreateBucket
• PutBucketLogging
Request Syntax
GET /?logging 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 (p. 127)
The bucket name for which to get the logging information.
Required: Yes
x-amz-expected-bucket-owner (p. 127)
The account ID of the expected bucket owner. If the bucket is owned by a different account, 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
<?xml version="1.0" encoding="UTF-8"?>
<BucketLoggingStatus>
<LoggingEnabled>
<TargetBucket>string</TargetBucket>
<TargetGrants>
<Grant>
<Grantee>
<DisplayName>string</DisplayName>
<EmailAddress>string</EmailAddress>
<ID>string</ID>
<xsi:type>string</xsi:type>
<URI>string</URI>
</Grantee>
<Permission>string</Permission>
</Grant>
</TargetGrants>
<TargetPrefix>string</TargetPrefix>
</LoggingEnabled>
</BucketLoggingStatus>
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in XML format by the service.
BucketLoggingStatus (p. 127)
Root level tag for the BucketLoggingStatus parameters.
Required: Yes LoggingEnabled (p. 127)
Describes where logs are stored and the prefix that Amazon S3 assigns to all log object keys for a bucket. For more information, see PUT Bucket logging in the Amazon S3 API Reference.
Type: LoggingEnabled (p. 704) data type
Examples
Sample Request
The following request returns the logging status for mybucket.
GET ?logging HTTP/1.1
Host: mybucket.s3.<Region>.amazonaws.com Date: Wed, 25 Nov 2009 12:00:00 GMT Authorization: authorization string