amazon-web-services - AWS CLI 配置配置文件参数

标签 amazon-web-services aws-cli

调用以下 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/

相关文章:

amazon-web-services - 配置 : Cognito (for the unauthenticated) and S3 中缺少凭据

python - 如何配置 Amazon EC2 实例以支持 python 分析器?

bash - 从 bash 中的 ACL 策略中删除 AllUsers

amazon-web-services - AWS IAM : Credential report via CLI

amazon-web-services - AWS s3 CLI "cp"和 "sync"触发什么事件?

amazon-web-services - 如何在不使用 AutoScaling 的情况下使用 aws cloudformation 启动多个 EC2 实例?

amazon-web-services - Terraform - 资源重复多次

amazon-web-services - 502 错误 : CloudFront wasn't able to connect to the origin

json - 如何使用 jq 解析 AWS CLI json 输出以获取卷 ID 数组?

amazon-web-services - 指定 VPC SubnetID/SecurityGroupIds 数组到 aws cli cloudformation 部署