首页 > 解决方案 > AWS 在单行命令中配置

问题描述

我正在尝试使用 Ansible 配置我的 AWS 账户,并且据我所知它需要在一行上(除非有一种方法可以在 Windows 命令中以编程方式按下“ENTER”)。

有没有办法做到这一点?

标签: shellamazon-web-servicescommand-lineamazon

解决方案


aws configure我们也可以交互地设置值,但是我们aws configure set可以直接设置值。

概要 aws configure set varname value [--profile profile-name]

OPTIONS
varname (string) The name of the config value to set. 
value (string) The value to set.

例如。

aws configure --profile myprofile set region us-east-1
aws configure --profile myprofile set aws_access_key_id XXXXXXXXXXX
aws configure --profile myprofile set aws_secret_access_key YYYYYYYY

或者,您也可以使用。

aws configure set profile.myprofile.region us-east-1
aws configure set profile.myprofile.aws_access_key_id XXXXXXXXXXX
aws configure set profile.myprofile.aws_secret_access_key YYYYYYYY

推荐阅读