How to search inside an S3 bucket
TL;DR
Amazon S3 has no native search API — every tool lists keys with ListObjectsV2 and filters them. S3 Viewer's “Filter by prefix” box is exactly that — a prefix filter over the folder you are currently in: it narrows the rows on screen and does not walk into subfolders or other buckets. For a recursive sweep, aws s3 ls --recursive | grep is fast enough on small to medium buckets. For buckets with millions of keys, S3 Inventory + Athena is the right pattern.
Steps
Step-by-step.
- 01
In S3 Viewer: filter the current folder
Type in the Filter by prefix box above the file list. It filters the rows in the folder you are looking at by key prefix, as you type — both folders and objects. It does not recurse into subfolders and it does not span buckets, so navigate into the prefix you care about first. - 02
Open the result
Click a folder to move into it and filter again, or click an object to preview it. The breadcrumb above the list shows the prefix you are filtering inside. - 03
AWS CLI: recursive list + grep
Quick and dirty. Works for small to medium buckets.aws s3 ls s3://my-bucket --recursive | grep <query> - 04
AWS CLI: list-objects-v2 with --prefix
Use--prefixto narrow the listing first, then filter the output. Faster on large buckets — listing happens server-side.aws s3api list-objects-v2 \ --bucket my-bucket \ --prefix logs/2026/ \ --query 'Contents[?Size > `1000000`]' - 05
For very large buckets: S3 Inventory + Athena
Enable S3 Inventory for a daily CSV/Parquet manifest of every key, then query it with Athena. The right pattern for buckets with millions or billions of objects — listing them via the API would take hours.
Under the hood
What's actually happening.
S3 has no search API. Its only listing primitive is ListObjectsV2 with a prefix and a delimiter, which is exactly what a folder view is: the delimiter groups everything below the current prefix into “folders”. S3 Viewer's Filter by prefix box works at that same level — it filters the rows already listed for the current prefix, so it is fast and predictable but scoped to one folder in one bucket. Anything recursive means walking the full listing yourself: aws s3 ls --recursive piped through grep for small and medium buckets, and S3 Inventory + Athena once a bucket has millions of keys. The same holds for Cloudflare R2, MinIO and Backblaze B2, since they implement the same listing API.
FAQ
Common questions.
How do I search for a file in an S3 bucket?
Why doesn't the AWS S3 console search find my file?
Can I search across multiple S3 buckets at once?
How do I search a Cloudflare R2 bucket?
Is there an S3 search API?
Use S3 Viewer for this
Skip the CLI. Try it in the browser.
S3 Viewer turns the steps above into a single click. Open source, self-hostable, free.
Use case
Why teams pick this
Related guides
More how-tos
Create a folder
S3 has no folders — only key prefixes. How the console, the CLI and S3 Viewer create one, and why an empty folder can vanish.
Switch buckets fast
Switch servers and buckets from the sidebar, plus AWS CLI named profiles for scripts.
View S3 + R2 together
One credential per provider, one sidebar, and one click to switch between them.