Skip to content

Instantly share code, notes, and snippets.

@anushshukla
Created October 21, 2020 15:03
Show Gist options
  • Select an option

  • Save anushshukla/fc80db760edb278d8a9bfc142ac15d86 to your computer and use it in GitHub Desktop.

Select an option

Save anushshukla/fc80db760edb278d8a9bfc142ac15d86 to your computer and use it in GitHub Desktop.
AWS S3 API List Objects Queries
aws s3api list-objects-v2 \
--bucket <bucket-name-here> \
--max-keys=5 \
--query "sort_by(Contents, &LastModified)[*].{Key:Key,Size:Size,LastModified:LastModified}"
--query "reverse(sort_by(Contents,&LastModified))" \
--query "Contents[?contains(Key, '<file-name-here>')]"
--query "Contents[?LastModified>='2020-10-18T17:49:00.000Z'][]" \
--query 'Contents[?LastModified>2020-08-29][].{Key: Key,LastModified: LastModified}'
--query 'Contents[?contains(LastModified, "2020-08-30")].Key'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment