lib/heirloom/aws/simpledb.rb in heirloom-0.11.0.beta.2 vs lib/heirloom/aws/simpledb.rb in heirloom-0.11.0

- old
+ new

@@ -4,12 +4,20 @@ module AWS class SimpleDB def initialize(args) @config = args[:config] - @sdb = Fog::AWS::SimpleDB.new :aws_access_key_id => @config.access_key, - :aws_secret_access_key => @config.secret_key, - :region => @config.metadata_region + + fog_args = { :region => @config.metadata_region } + + if @config.use_iam_profile + fog_args[:use_iam_profile] = true + else + fog_args[:aws_access_key_id] = @config.access_key + fog_args[:aws_secret_access_key] = @config.secret_key + end + + @sdb = Fog::AWS::SimpleDB.new fog_args end def domains @sdb.list_domains.body['Domains'] end