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

178
Views
boto s3 Bucket versus get_bucket

I try to access a key inside a bucket, for which I don't have permissions, though I do for the key. In order to be able to do get_key('this/is/my_key'), I need the bucket object:

conn = boto.connect_s3(key, secret_key)
my_bucket = conn.get_bucket('a_bucket')

yields S3ResponseError: S3ResponseError: 403 Forbidden.

On the other hand, the following works

my_bucket = boto.s3.bucket.Bucket(conn, 'a_bucket')
my_bucket.get_key('this/is/my_key')

Question: What is the difference between creating the object Bucket and using the get_bucket method? Checking the docu I only see the check for validation. Anything else?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Validation (validate=True default) in the get_bucket checks for bucket's existence when called. Since you don't have access to the bucket, your request is turned down (403). In the other case, the class instantiation doesn't seem to do the validation, hence the get_key method works as intended.

over 4 years ago · Santiago Trujillo Report

0

get_bucket() need s3:listObject permission

get_key() only need s3:GetObject permission

Thus following line DOES NOT create any bucket.

my_bucket = boto.s3.bucket.Bucket(conn, 'a_bucket')

It just create a python object class pointing to the bucket. There is no error as long as you didn't perform any bucket related task. If you can do a get_key() without error, it's mean you are given the s3:GetObject permission to the bucket.

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!