flexera-public / right_aws

RightScale Amazon Web Services Ruby Gems
MIT License
451 stars 175 forks source link

AWS going to rate limit "list all my buckets" call #126

Open alexchee opened 12 years ago

alexchee commented 12 years ago

AWS had this update out yesterday and we ran into problems with any several calls involving buckets, until AWS reverted their change. Explained here: https://forums.aws.amazon.com/thread.jspa?messageID=333265&#333250

In the right_s3.rb, the bucket method loops through buckets which always calls the "list all my buckets" API. right_s3.rb, lines 106-111:

    buckets.each do |bucket| 
      if bucket.name == name 
        result = bucket
        break
      end
    end

right_s3.rb, lines 73-78:

    def buckets
      @interface.list_all_my_buckets.map! do |entry|
        owner = Owner.new(entry[:owner_id], entry[:owner_display_name])
        Bucket.new(self, entry[:name], entry[:creation_date], owner)
      end
    end

Is there a solution to referencing Buckets without using the list_all_my_buckets call?

alexchee commented 12 years ago

Ok, so the alternative for me is to never use the RightAws::S3 bucket method and just initialize RightAws::S3::Bucket.new() directly.

Ex.

s3 = RightAws::S3.new(aws_access_key, aws_secret_key)
myBucket = RightAws::S3::Bucket.new(s3, 'bucket_name')

I'm not sure if not specifying an owner or creation date will have any side effects.