AWS S3 listObjectV2 Feature Requests

0

It is stated in the documentation in listObjectV2 API(Javascript SDK) that "Objects are returned sorted in an ascending order of the respective key names in the list. For more information about listing objects", is it possible to add a feature to sort it in descending order?

질문됨 2년 전901회 조회
1개 답변
-1

Hello,

I understand that you need to list S3 Objects in descending order. I also see that you have read the AWS Documentation about this matter, however it is not clearly stated that there is a way to list S3 Objects in descending order even if you are using the revised API ListObjectV2

I have done some research and found that you can use python's sorted function to sort the keys in descending order.

Here is a code sample:

import boto3
s3 = boto3.client('s3')
res = s3.list_objects(Bucket='bucketname')
output = sorted(res['Contents'],key=lambda i:i['Key'],reverse=True)  
print(output)

To list object keys programmatically using other languages, please refer to this AWS Document.

I hope this helps.

Lunga T
답변함 2년 전
  • Hi Lunga!

    Thanks for the reply. Is there an equivalent in Javascript SDK for this? That is what I'm using right now, as far as i know based on docs, this is not implemented yet.

  • This is not a solution if you keep any meaninful number of objects in S3. It makes no sense that you wouldn't at least allow a reverse sort order. Even better, let me sort by creation date in either ascending or descending order.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠