S3Client.list_buckets
rboto-s3==0.4.0 · Service index · Types
Model summary (excerpt): This operation is not supported for directory buckets. Returns a list of all buckets owned by the authenticated sender of the request. To grant IAM permission to use this operation, you must add the s3:ListAllMyBuckets policy action. For information about Amazon S3 buckets, see Creating, configuring, and working with Amazon S3 buckets . We strongly recommend using only paginated ListBuckets...
Install and imports
Signature
async def list_buckets(
*,
max_buckets: int | None = None,
continuation_token: str | None = None,
prefix: str | None = None,
bucket_region: str | None = None,
) -> ListBucketsOutput: ...
Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.
Arguments
| Argument | Required | Model notes (excerpt) |
|---|---|---|
max_buckets |
No | Maximum number of buckets to be returned in response. When the number is more than the count of buckets that are owned by an Amazon Web Services account, return all the buckets in response. |
continuation_token |
No | 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 this ContinuationToken for pagination of the list results. Length Constraints: Minimum length of 0. Maximum length of 1024. Required: No. If you specify the bucket-region , prefix , or continuation-token query parameters... |
prefix |
No | Limits the response to bucket names that begin with the specified bucket name prefix. |
bucket_region |
No | Limits the response to buckets that are located in the specified Amazon Web Services Region. The Amazon Web Services Region must be expressed according to the Amazon Web Services Region code, such as us-west-2 for the US West (Oregon) Region. For a list of the valid values for all of the Amazon Web Services Regions, see Regions and Endpoints . Requests made to a Regional endpoint that is... |
Output
ListBucketsOutput.
Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.
| Field | Type | Presence | References |
|---|---|---|---|
buckets |
list[BucketOutput] | None |
Always present | BucketOutput |
owner |
OwnerOutput | None |
Always present | OwnerOutput |
continuation_token |
str | None |
Always present | — |
prefix |
str | None |
Always present | — |
| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.
Related types
Follow these links for nested inputs and outputs; recursive types link back to the same type page.
Pagination and streaming
client.paginators.list_buckets(...) accepts the same arguments and returns AsyncIterator[ListBucketsOutput]. Direct calls return one page. Pages preserve the Output representation above.
Input cursors: continuation_token. Page-size argument: max_buckets.
No output stream.
Errors
No modeled service errors for this operation.
Other service failures use the service base error; credential, transport and timeout failures use shared errors.