Collections - Boto3 1.34.74 documentation
Controlling page size
Collections automatically handle paging through results, but you may want
to control the number of items returned from a single service operation
call. You can do so using thepage_size() method:
# S3 iterate over all objects 100 at a timefor obj in bucket.objects.page_size(100): print(obj.key)
By default, S3 will return 1000 objects at a time, so the above code would let you process the items in smaller batches, which could be beneficial for slow or unreliable internet connections.