调用以下 AWS CLI 开发工具包命令会触发 shell 提示输入一系列值:
$ aws configure --profile profilename
$ AWS 访问 key ID [无]: 等等……
有什么方法可以指定行中的参数吗?例如
$ aws configure --profile profilename --access-key=foo --access-secret=goo --region=bar
感谢广告, 迈克尔·麦克杜
最佳答案
有点。您无法一次完成所有操作(aws configure help
将向您显示没有此类选项),但可以一次完成一个。
来自aws configure set help
:
Given an empty config file, the following commands:
$ aws configure set aws_access_key_id default_access_key $ aws configure set aws_secret_access_key default_secret_key $ aws configure set default.region us-west-2 $ aws configure set default.ca_bundle /path/to/ca-bundle.pem $ aws configure set region us-west-1 --profile testing $ aws configure set profile.testing2.region eu-west-1 $ aws configure set preview.cloudsearch true
will produce the following config file:
[default] region = us-west-2 ca_bundle = /path/to/ca-bundle.pem [profile testing] region = us-west-1 [profile testing2] region = eu-west-1 [preview] cloudsearch = true
and the following ~/.aws/credentials file:
[default] aws_access_key_id = default_access_key aws_secret_access_key = default_secret_key
请注意,您还可以在运行其他 aws
命令时临时将凭据设置为环境变量。如果您对此感兴趣,see the documentation .不过,您不能只设置它们并运行 aws configure --profile profilename
- 这仍会提示您。
关于amazon-web-services - AWS CLI 配置配置文件参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48592358/