【发布时间】:2015-02-06 18:29:08
【问题描述】:
我在$HOME/.aws/config 文件中通过[profile X] 定义了几个AWS 密钥。当我尝试将这些与aws-rb 一起使用时,似乎该工具应该与它们一起使用。但是我无法让它这样做。特别是下面的--profile 开关:
$ aws-rb --help
Usage: aws-rb [options]
--repl REPL specify the repl environment, pry or irb
-e 'command' one line of script. Several -e's allowed.
-l, --[no-]log log client requets, on by default
-c, --[no-]color colorize request logging, on by default
--profile PROFILE Use a specific profile from your credential file.
-d, --[no-]debug log HTTP wire traces, off by default
-Idirectory specify $LOAD_PATH directory (may be used more than once)
-rlibrary require the library
-v, --verbose enable client logging and HTTP wire tracing
-q, --quiet disable client logging and HTTP wire tracing
-h, --help
示例
我想使用的个人资料:
$ grep stag ~/.aws/config
[profile stag]
当我尝试获取 S3 存储桶名称列表时:
$ aws-rb -vd --profile stag
[1]pry(AWS)> s3.buckets.map(&:name)
AWS::Errors::MissingCredentialsError:
Missing Credentials.
如果我使用 aws,我可以从 AWS 配置文件中看到我的凭证工作正常:
$ AWS_DEFAULT_PROFILE=stag /usr/bin/aws s3 ls
2014-03-01 14:36:38 bucket1
2013-07-01 12:01:29 bucket2
参考文献
【问题讨论】: