title: Boto3 S3, sort bucket by last modified
body: <p>I need to fetch a list of items from S3 using Boto3, but instead of returning default sort order (descending) I want it to return it via reverse order.</p>
  
  <p>I know you can do it via awscli:</p>
  
  <pre><code>aws s3api list-objects --bucket mybucketfoo --query "reverse(sort_by(Contents,&amp;LastModified))"
  </code></pre>
  
  <p>and its doable via the UI console (not sure if this is done client side or server side)</p>
  
  <p>I cant seem to see how to do this in Boto3.</p>
  
  <p>I am currently fetching all the files, and then sorting...but that seems overkill, especially if I only care about the 10 or so most recent files.</p>
  
  <p>The filter system seems to only accept the Prefix for s3, nothing else.</p>