尝试将AWS CLI用于我正在使用的EC2实例时,收到以下错误。
[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ aws
Traceback (most recent call last):
File "/usr/bin/aws", line 27, in <module>
sys.exit(main())
File "/usr/bin/aws", line 23, in main
return awscli.clidriver.main()
File "/usr/lib/python2.7/dist-packages/awscli/clidriver.py", line 54, in main
return driver.main()
File "/usr/lib/python2.7/dist-packages/awscli/clidriver.py", line 186, in main
command_table = self._get_command_table()
File "/usr/lib/python2.7/dist-packages/awscli/clidriver.py", line 96, in _get_command_table
self._command_table = self._build_command_table()
File "/usr/lib/python2.7/dist-packages/awscli/clidriver.py", line 116, in _build_command_table
command_object=self)
File "/usr/local/lib/python2.7/site-packages/botocore-1.4.8-py2.7.egg/botocore/session.py", line 680, in emit
return self._events.emit(event_name, **kwargs)
File "/usr/local/lib/python2.7/site-packages/botocore-1.4.8-py2.7.egg/botocore/hooks.py", line 226, in emit
return self._emit(event_name, kwargs)
File "/usr/local/lib/python2.7/site-packages/botocore-1.4.8-py2.7.egg/botocore/hooks.py", line 209, in _emit
response = handler(**kwargs)
File "/usr/lib/python2.7/dist-packages/awscli/customizations/opsworkscm.py", line 21, in alias_opsworks_cm
alias_command(command_table, 'opsworkscm', 'opsworks-cm')
File "/usr/lib/python2.7/dist-packages/awscli/customizations/utils.py", line 71, in alias_command
current = command_table[existing_name]
KeyError: 'opsworkscm'
我不太清楚为什么会这样。我正在使用类似于这个工作的其他ec2实例设置,但我不确定可能导致此错误的差异。
答案 0 :(得分:1)
我在aws-cli GH repo中遇到过这个问题。我运行sudo pip install awscli
并将botocore更新为版本1.4.86,这解决了我的问题。
答案 1 :(得分:0)
我使用的是Ubuntu Xenial,需要比1.4.38更新,所以我使用的是Ubuntu / Zesty的awscli。
与pip一样,你需要升级python3-botocore,这对我有用:
apt-get install awscli python3-botocore
(来自兴致勃勃的资料库)。
答案 2 :(得分:0)
您的/usr/bin/aws
必须是旧的可执行文件。
whereis aws
。您将获得aws
可执行文件的列表。aws --version
。sudo rm /usr/bin/aws