How to use boto3 (or other Python) to list the contents of a _RequesterPays_ S3 bucket?


You can download a file via boto3 from a RequesterPays S3 bucket, as follows:

What I can’t figure out is how to list the objects in the bucket… I get an authentication error when I try and call objects.all() on the bucket.

How can I use boto3 to enumerate the contents of a RequesterPays bucket? Please note this is a particular kind of bucket where the requester pays the S3 charges.


From boto3, we can see that there is a #S3.Client.list_objects method. This can be used to enumerate objects:


If you are getting a 401 then make sure that IAM user calling the API has s3:GetObject permissions on the bucket.

Leave a Reply