I am trying to retrieve all buckets s3 via boto3 python. I have tried;
s3_resource.buckets.all()
and s3_client.list_buckets()
both of these gives at most 1000 buckets but there are over 1000 buckets that I've found. Is there a way to get all buckets?
I have also seen Java and C++ use an iterator to traverse through the list, is there something similar for python?
Using Paginator for list_buckets
paginator = self.client.get_paginator('list_buckets')
pages = paginator.paginate()
OperationNotPageableError: Operation cannot be paginated: list_buckets
About writing a custom paginator
list_buckets
doesn't take in any request parameters.
Even the API call docs.aws.amazon.com/AmazonS3/latest/API/API_ListBuckets.html
However in the response I see
transfer-encoding : chunked
I wonder if I can use that somehow?