Ruby Amazon S3 Access Denied when listing buckets

2019-03-14 20:07发布

Ruby newb here.

I was given access creds to data on the amazon cloud. Im beginning to think the access keys are off but I could be wrong. Someone help!

I have the aws folder as a plugin

>> Version
=> "0.6.3"

>> AWS::S3::Base.establish_connection!(:access_key_id =>'*******', :secret_access_key => '*****')
=> #<AWS::S3::Connection:0x007fd0539bb4c0 @options={:server=>"s3.amazonaws.com", :port=>80, :access_key_id=>"****", :secret_access_key=>"****"}, @access_key_id="****", @secret_access_key="****", @http=#<Net::HTTP s3.amazonaws.com:80 open=false>>

>> AWS::S3::Service.buckets   
=> AWS::S3::AccessDenied: Access Denied

from /Users/PBR/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/error.rb:38:in `raise'
from /Users/PBR/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/base.rb:72:in `request'
from /Users/PBR/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/base.rb:88:in `get'
from /Users/PBR/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/service.rb:21:in `buckets'
from /Users/PBR/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:183:in `block in buckets'
from /Users/PBR/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:152:in `expirable_memoize'
from /Users/PBR/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:182:in `buckets'

5条回答
ら.Afraid
2楼-- · 2019-03-14 20:11

You can fix this in following way.

  1. First go to s3 console in amazon.
  2. Then click on bucket.
  3. Then click on properties tab in right side.
  4. Then click on permission options
  5. Click on add more permission
  6. Check the all checkbox and save it.
查看更多
我想做一个坏孩纸
3楼-- · 2019-03-14 20:12

Turns out my Access Keys were invalid. I had the admin grant me further permissions and it finally worked.

Thanks!!

查看更多
劳资没心,怎么记你
4楼-- · 2019-03-14 20:18

IAM, Groups where your user have been part of, and add S3FullAccess or S3 ReadOnlyAccess

查看更多
虎瘦雄心在
5楼-- · 2019-03-14 20:31

The correct answer to this is definitely: IAM -> Users -> "Attach User Policy" and make your user admin
enter image description here

查看更多
别忘想泡老子
6楼-- · 2019-03-14 20:32

I had to go IAM -> Users -> "Attach User Policy" and make my user admin

查看更多
登录 后发表回答