ListBuckets
Note
This operation is not supported by directory buckets.
Returns a list of all buckets owned by the authenticated sender of the request. To use
this operation, you must have the s3:ListAllMyBuckets
permission.
For information about Amazon S3 buckets, see Creating, configuring, and working with Amazon S3 buckets.
Request Syntax
GET /?continuation-token=ContinuationToken
&max-buckets=MaxBuckets
HTTP/1.1
Host: s3.amazonaws.com
URI Request Parameters
The request uses the following URI parameters.
- continuation-token
-
ContinuationToken
indicates to Amazon S3 that the list is being continued on this bucket with a token.ContinuationToken
is obfuscated and is not a real key. You can use thisContinuationToken
for pagination of the list results.Length Constraints: Minimum length of 0. Maximum length of 1024.
Required: No.
- max-buckets
-
Maximum number of buckets to be returned in response. When the number is more than the count of buckets that are owned by an AWS account, return all the buckets in response.
Valid Range: Minimum value of 1. Maximum value of 1000.
Request Body
The request does not have a request body.
Response Syntax
HTTP/1.1 200
<?xml version="1.0" encoding="UTF-8"?>
<ListAllMyBucketsResult>
<Buckets>
<Bucket>
<CreationDate>timestamp</CreationDate>
<Name>string</Name>
</Bucket>
</Buckets>
<Owner>
<DisplayName>string</DisplayName>
<ID>string</ID>
</Owner>
<ContinuationToken>string</ContinuationToken>
</ListAllMyBucketsResult>
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.
- ListAllMyBucketsResult
-
Root level tag for the ListAllMyBucketsResult parameters.
Required: Yes
- Buckets
-
The list of buckets owned by the requester.
Type: Array of Bucket data types
- ContinuationToken
-
ContinuationToken
is included in the response when there are more buckets that can be listed with pagination. The nextListBuckets
request to Amazon S3 can be continued with thisContinuationToken
.ContinuationToken
is obfuscated and is not a real bucket.Type: String
- Owner
-
The owner of the buckets listed.
Type: Owner data type
Examples
Sample Request
The following request returns a list of all buckets of the sender.
HTTP/1.1 200 OK <ListAllMyBucketsResult> <Buckets> <Bucket> <CreationDate>2019-12-11T23:32:47+00:00</CreationDate> <Name>DOC-EXAMPLE-BUCKET</Name> </Bucket> <Bucket> <CreationDate>2019-11-10T23:32:13+00:00</CreationDate> <Name>DOC-EXAMPLE-BUCKET2</Name> </Bucket> </Buckets> <Owner> <DisplayName>Account+Name</DisplayName> <ID>AIDACKCEVSQ6C2EXAMPLE</ID> </Owner> </ListAllMyBucketsResult>
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: