Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

188
Views
Does boto3 Bucket.object.filter retrieve object efficiently?

I want to get a list of all the objects(or max 1000) located at foo-bucket/foo-dir , e.g.

Bucket: foo-bucket

Directory: foo-dir

I see Bucket.objects boto3 API use filtering(Bucket.objects.filter)

I am wondering what it does internally? Does it list all the objects and filter? Or does AWS provide an API that takes filter arguments and return the filtered results.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The S3 API supports a prefix on the ListObjects request that will filter the responses to include only those objects whose name matches the prefix. So:

import boto3

s3 = boto3.resource('s3')
bucket = s3.Bucket('mybucket')
for obj in bucket.objects.filter(Prefix='foo/bar/fie/baz/'):
    # do something with obj here

Would only return objects whose name begins with the prefix foo/bar/fie/baz/.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!