Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the ListObjects command guarantee the results are sorted by key?

When calling the S3 ListObjects command (via either REST or SOAP API), is the result set returned in any particular order? I would expect, given the nature of object keys and markers, that the result set is always sorted by object key. But I haven't seen any documentation confirming this.

like image 784
C. Dragon 76 Avatar asked Nov 04 '10 22:11

C. Dragon 76


People also ask

What does S3 listObjects return?

Returns some or all (up to 1,000) of the objects in a bucket. You can use the request parameters as selection criteria to return a subset of the objects in a bucket. A 200 OK response can contain valid or invalid XML.

What does ListObjectsV2 return?

The ListObjectsV2() will always return up to 1000 objects alphabetically in the requested Prefix.

What is object key in S3?

The object key (or key name) uniquely identifies the object in an Amazon S3 bucket. Object metadata is a set of name-value pairs. For more information about object metadata, see Working with object metadata. When you create an object, you specify the key name, which uniquely identifies the object in the bucket.


1 Answers

Update: Amazon has changed their documentation as shown below.

They are returned alphabetically. List results are always returned in UTF-8 binary order. See http://docs.aws.amazon.com/AmazonS3/latest/dev/ListingKeysUsingAPIs.html

Amazon S3 exposes a list operation that lets you enumerate the keys contained in a bucket. Keys are selected for listing by bucket and prefix. For example, consider a bucket named 'dictionary' that contains a key for every English word. You might make a call to list all the keys in that bucket that start with the letter "q". List results are always returned in lexicographic (alphabetical) order List results are always returned in UTF-8 binary order.

like image 170
Geoff Appleford Avatar answered Sep 24 '22 17:09

Geoff Appleford