简体   繁体   中英

Amazon aws s3 client error aws-sdk ruby

initializer/aws.rb

  keys = Rails.application.credentials[:aws]

creds = Aws::Credentials.new(keys[:access_key_id], keys[:secret_access_key])

Aws.config.update({
  service: "s3",
  region: 'eu-west-2',
  credentials: creds
})

when i do in my controller this i get error

s3 = Aws::S3::Client.new(
  region: Aws.config[:region],
  credentials: Aws.config[:credentials]
)

#ArgumentError (invalid configuration option `:service'):

I use IAM credentials ruby-sdk-3

ok I deleted service from Aws.config and it works but it would be nice to store this param in config

s3 = Aws::Client.new(
  region: Aws.config[:region],
  credentials: Aws.config[:credentials]
)

try with this!!

AWS Ruby-sdk

I hope this will help you!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM