CentOS7安装awscli
<p>注意:在CentOS7中安装awscli前,先安装Python3,可参考</p>
<h3>1.awscli安装</h3>
<p>在保证python3安装成功后,可以继续下一步安装awscli。
说明:</p>
<h4>(1)安装awscli</h4>
<p>CentOS7下python3.6安装成功后,可以安装awscli。</p>
<h4>(2)以非root安装awscli</h4>
<p>CentOS7下yum安装python3.6后,以root安装awscli成功,但安装过程中有提示不建议用root安装。最后在使用命令找不到,aws —version,which aws都打不到命令。最后结果是要用非root安装。</p>
<h4>(3)安装aswcli</h4>
<p><code>pip3 install awscli --upgrade --user</code>
安装成功后,可以正常使用。
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=’files.pythonhosted.org’, port=443): Read timed out.
报错:上述提示的原因是超时了,再安装即可。</p>
<h4>(4)查看版本验证是否安装aws</h4>
<p>$ aws --version</p>
<p>附:awscli安装可参见
<a href="https://docs.aws.amazon.com/zh_cn/cli/latest/userguide/cli-chap-install.html">https://docs.aws.amazon.com/zh_cn/cli/latest/userguide/cli-chap-install.html</a></p>
<h3>2.登录awscli验证</h3>
<pre><code class="language-bash">[builder@localhost ~]$ aws ecr get-login --no-include-email --region cn-northwest-1
Unable to locate credentials. You can configure credentials by running "aws configure".
[builder@localhost ~]$ aws configure
AWS Access Key ID [None]: 参见~/.aws/credentials
AWS Secret Access Key [None]: 参见~/.aws/credentials
Default region name [None]: 参见~/.aws/config
Default output format [None]: json</code></pre>
<p>完成aws configure配置后,进行登录验证
<code>[builder@localhost ~]$ aws ecr get-login --no-include-email --region cn-northwest-1</code>
利用随机生成的返回字符串进行登录验证,成功即可。</p>