I am using the following syntax to list versions in s3 using boto3.
object_versions = s3.list_object_versions(Bucket=bucket_name)
Strangely, it is not listing the objects with only one version left. Please see the screenshot below, i can see the objects on the aws console but i can’t get them from my boto3 script.
2
Answers
I found the problem. The list object api of boto3 only lists limited results (~1000 objects). To go beyond you may need to use paginator.
Here is a sample code, you can ignore the unwanted lines.
This code will print information about all versions, including both versioned objects and their delete markers.