本文介绍了无法在EC2 CLI上运行``aws configure''命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用基于AWS EC2 Linux的服务器,当我运行命令"aws configure"

I am using aws ec2 linux based server,when i run the command "aws configure"

出现以下错误:

Traceback (most recent call last):
  File "/usr/bin/aws", line 19, in <module>
    import awscli.clidriver
  File "/usr/lib/python2.7/dist-packages/awscli/clidriver.py", line 17, in <module>
    import botocore.session
  File "/usr/local/lib/python2.7/site-packages/botocore/session.py", line 31, in <module>
    import botocore.client
  File "/usr/local/lib/python2.7/site-packages/botocore/client.py", line 16, in <module>
    from botocore import waiter, xform_name
  File "/usr/local/lib/python2.7/site-packages/botocore/waiter.py", line 18, in <module>
    from botocore.docs.docstring import WaiterDocstring
ImportError: No module named docs.docstring

使用以下版本:的Python:3.5点:20.3.4awscli:1.18.223boto3:1.16.63

using the following versions:python: 3.5pip: 20.3.4awscli: 1.18.223boto3: 1.16.63

推荐答案

在EC2实例上配置凭据的非常差的做法.您整个AWS帐户的安全受到威胁

相反,使用角色如果要从ec2实例运行aws cli命令,请执行此操作.假设您要运行aws s3 ls(用于列出存储桶)

instead, use roles do this if you want to run aws cli commands from ec2 instance. lets say you wan to run aws s3 ls ( for listing buckets)

  • 转到IAM->角色->创建角色->选择服务Ec2.
  • 附加权限->S3只读访问权限.
  • 输入角色的描述和名称
  • 转到您的实例->右键单击实例设置
  • 附加刚刚创建的Iam角色
  • ssh进入您的实例.
  • 运行aws configure->只需按Enter键即可输入密钥ID,访问密钥保留为空白.
  • 输入您的区域,例如 eu-west-3 ,这样请求就到达了该区域.
  • 运行aws s3 ls
  • Go to IAM -> roles -> create a role -> select service Ec2.
  • attach permissions -> S3 read only access.
  • enter description and name of the role
  • go to your instance -> right click instance settings
  • attach Iam role, you just created
  • ssh into your instance.
  • run aws configure -> just hit enter for key id and access key leave it BLANK.
  • enter your region for eg eu-west-3 so that request got to that region.
  • run aws s3 ls

您可以在您提到的区域看到水桶.

you can see your buckets in the region you mentioned.

这篇关于无法在EC2 CLI上运行``aws configure''命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-28 05:29