Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (5.6k points)
Is there any way to specify to only include the latest version of each in the "ListVersionRequest"?

I need the version value, so a simple "AmazonS3Client.listObject()" will not be sufficent as "S3ObjectSummary" has no version information.

I'm trying to create a utility that ping S3 for all objects in the versioned bucket and compares the latest version value to what the utility is already tracking.

The only solution I can think of right now is just to do "AmazonS3Client.listVersions()", iterate through the "S3VersionSummary.list", handle the first most recent version then manually iterate and skip all older versions of an object until it gets to the new key. Is this the best solution?

1 Answer

0 votes
by (12.4k points)

I only see two options over here:

First, Do what you described and list all versions of the data that you have. After that,  you'll get a list that is in order of versioning, so you'll need to know when to stop checking for versions. I think that this can be done by iterating through the list of versions and stopping at the first "islatest()" call that returns false ref

Or, You can list objects and then get the object summary for each object which will contain the version ID.

Do you want to master AWS? Then do check out the AWS Course by Intellipaat.

Related questions

0 votes
1 answer

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
...