简体   繁体   中英

With Rails Aws Gem version 2, how do you configure it to use your access keys?

According to this blog post, the new version of the Aws gem switches the namespace from AWS to Aws. But what am I supposed to use instead of

Aws.config({
  access_key_id: "something",
  secret_access_key: "something"
})

It's explained here but doesn't say what the alternative is: http://ruby.awsblog.com/post/TxFKSK2QJE6RPZ/Upcoming-Stable-Release-of-AWS-SDK-for-Ruby-Version-2

Instead, I get an error:

Uncaught exception: wrong number of arguments (1 for 0)

AWS.config is no longer a method in v2. You now call Aws.config.update with a simple hash:

# v1
AWS.config({
  access_key_id: "something",
  secret_access_key: "something"
})

# v2
Aws.config.update({
  access_key_id: "something",
  secret_access_key: "something"
})

Here you have the link to the configuration options for more info related to #v2.

Looking at this section in the doc: http://docs.aws.amazon.com/sdkforruby/api/index.html#Configuration it seems that the way you configure the credentials has changed.

I can't find the .config method in the docs anymore, it is now an attribute of Aws.

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