If there are not many objects in the bucket, you can use Python to sort as you wish.
Define lambda to get the last modified time:
get_last_modified = lambda obj: int(obj['LastModified'].strftime('%s'))
Get all objects and sort them by last modified time.
s3 = boto3.client('s3')
objs = s3.list_objects_v2(Bucket='my_bucket')['Contents']
[obj['Key'] for obj in sorted(objs, key=get_last_modified)]
If you want to cancel sorting:
[obj['Key'] for obj in sorted(objs, key=get_last_modified, reverse=True)]
source
share