Skip to content

Listing all keys in S3 bucket using python boto

Source: FlickrWhen using python-boto package to list keys in your S3 bucket, you might hit a limit of 1000 keys when using function call bucket.get_all_keys(). In order to get full list of keys just do something along the lines of

keylist = [k for k in self.bucket]

since as it turns out, bucket has an iterator over key name.

(Discovered through patch of Mitchell Garnaat to Duplicity project).