How to search an Amazon S3 Bucket using Wildcards?

As stated in a comment, Amazon's UI can only be used to search by prefix as per their own documentation:

http://docs.aws.amazon.com/AmazonS3/latest/UG/searching-for-objects-by-prefix.html

There are other methods of searching but they require a bit of effort. Just to name two options, AWS-CLI application or Boto3 for Python.

I know this post is old but it is high on Google's list for s3 searching and does not have an accepted answer. The other answer by Harish is linking to a dead site.

UPDATE 2020/03/03: AWS link above has been removed. This is a link to a very similar topic that was as close as I could find. https://docs.aws.amazon.com/AmazonS3/latest/dev/ListingKeysHierarchy.html


You can use the copy function with the --dryrun flag:

aws s3 ls s3://your-bucket/any-prefix/ .\ --recursive --exclude * --include *.pdf --dryrun

It would show all of the files that are PDFs.


AWS CLI search: In AWS Console,we can search objects within the directory only but not in entire directories, that too with prefix name of the file only(S3 Search limitation).

The best way is to use AWS CLI with below command in Linux OS

aws s3 ls s3://bucket_name/ --recursive | grep search_word | cut -c 32- 

Searching files with wildcards

aws s3 ls s3://bucket_name/ --recursive |grep '*.pdf'