Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Listing buckets with AWS::S3 in Sinatra

I'm trying to access my Amazon S3 account using the aws-s3 gem, but no matter what I do, I can't even print a bucket list.

Error:

undefined method `bytesize' for #<AWS::S3::Bucket:0x1b9e488>

From Code:

# hello_world.rb
require 'rubygems'
require 'sinatra'
require 'aws/s3'

get '/' do
  connection = AWS::S3::Base.establish_connection!(
     :access_key_id     => '***',
     :secret_access_key => '***'
   )
  AWS::S3::Service.buckets
end

I'm not too experienced with Ruby, am I just missing something obvious?

like image 566
arbales Avatar asked Nov 26 '25 23:11

arbales


1 Answers

You really should obfuscate your AWS secred_access_key before pasting it at stackoverflow, or at least change it now before somebody starts playing with your buckets...

like image 167
jrom Avatar answered Nov 28 '25 13:11

jrom



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!