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

273
Views
Boto3: Uso de boto3.resource('s3') para enumerar todos los cubos de S3

¿Es posible enumerar todos los depósitos S3 utilizando un recurso boto3, es decir, boto3.resource('s3') ?

Sé que es posible hacerlo usando un cliente de servicio de bajo nivel:

 import boto3 boto3.client('s3').list_buckets()

Sin embargo, en un mundo ideal podemos operar en el nivel más alto de recursos. ¿Existe algún método que nos permita hacerlo y, si no, por qué?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Puede usar s3.buckets.all() :

 s3 = boto3.resource('s3') for bucket in s3.buckets.all(): print(bucket.name)

Usando la lista de comprensión:

 s3 = boto3.resource('s3') buckets = [bucket.name for bucket in s3.buckets.all()] print(buckets)
over 4 years ago · Santiago Trujillo Report

0

Obtenga .buckets.pages() del recurso S3 y luego recorra las páginas para tomar los cubos:

 import boto3 buckets_iter = boto3.resource('s3').buckets.pages() buckets = [] for bucket in buckets_iter: buckets += bucket print(buckets)

Espero que esto ayude.

over 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!