uninitialized constant AWS::S3::Base via AWS-SDK
Yeah, aws-sdk doesn't have AWS::S3::Base
. I think this is the closest equivalent:
s3 = AWS::S3.new(:access_key_id => '****', :secret_access_key => '***')
As this was the first page that popped up for me on my google search to solve this issue I will comment on how I managed to solve it. Under the AWS SDK 2.0.47
require 'rubygems'require 'aws/s3'include AWS::S3AWS::S3::Base.establish_connection!( :access_key_id => '', :secret_access_key => '')
I was simply missing the include AWS::S3. And I suspect many people are running into this issue as I have yet to see a straight foward answer.
I tried Konstantino solution but, unfortunately, it didn't work for me. using include AWS::S3
threw the following exception.
TypeError: wrong argument type Class (expected Module)
This is how I solved the same issue
AWS.send(:remove_const, :S3) if AWS::S3.class == Classrequire Gem::Specification.find_by_name("aws-s3").gem_dir + "/lib/aws/s3.rb"
as I was using aws-s3
's modules and methods in another method that was initiated using delayed_job
, this patch didn't create issue in my case. But this can create issues in another use case as aws-sdk
's class is now replaced with aws-s3
's module.