Bash脚本以安装AWS CLI工具 [英] Bash script to install AWS CLI tools
本文介绍了Bash脚本以安装AWS CLI工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写一个bash脚本,它将自动安装和配置AWS CLI工具.我能够安装AWS CLI工具,但无法对其进行配置.
I am writing a bash script that will automatically install and configure AWS CLI tools. I am able to install AWS CLI tools but unable to configure it.
我的脚本是这样的:
#!/bin/bash
wget https://s3.amazonaws.com/aws-cli/awscli-bundle.zip
unzip awscli-bundle.zip
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
./awscli-bundle/install -b ~/bin/aws
./awscli-bundle/install -h
aws configure
AWS Access Key ID [None]: ABCDEFGHIJKLMNOP ## unable to provide this data
AWS Secret Access Key [None]: xbdwsdADDS/ssfsfa/afzfASADQASAd ## unable to provide this data
Default region name [None]: us-west-2 ## unable to provide this data
Default output format [None]: json ## unable to provide this data
我也希望使用此脚本进行配置.我希望我可以通过脚本提供这些凭据,以防止手动输入.该怎么办?
I wish to do the configuration using this script too. I wish that I can provide these credentials via script so that it prevents manual entry. How can this be done?
推荐答案
使用配置文件而不是aws configure
命令.创建一个名为~/.aws/config
的文件,如下所示:
Use a configuration file rather than the aws configure
command. Create a file called ~/.aws/config
that looks like this:
[default]
aws_access_key_id=AKIAIOSFODNN7EXAMPLE
aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
region=us-west-2
output=json
更多信息在文档中.
这篇关于Bash脚本以安装AWS CLI工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文