The CLI can do this; aws s3
only supports prefixes, but aws s3api
supports arbitrary filtering. For s3 links that look like s3://company-bucket/category/obj-foo.pdf
, s3://company-bucket/category/obj-bar.pdf
, s3://company-bucket/category/baz.pdf
, you can run
aws s3api list-objects --bucket "company-bucket" --prefix "category/" --query "Contents[?ends-with(Key, '.pdf')]"
or for a more general wildcard
aws s3api list-objects --bucket "company-bucket" --prefix "category/" --query "Contents[?contains(Key, 'foo')]"
or even
aws s3api list-objects --bucket "company-bucket" --prefix "category/obj" --query "Contents[?ends_with(Key, '.pdf') && contains(Key, 'ba')]"
The full query language is described at JMESPath.