我使用控制台创建了一个 Elastic Beanstalk 环境。然后我登录到 EB EC2 实例并
安装 awsebcli:
sudo pip install awsebcli
我配置了aws:
aws configure
并运行“eb init”:
eb init
然后我收到以下错误:
2015-05-06 20:09:41,678 (ERROR) ebcli.lib.aws : Error while contacting Elastic Beanstalk Service
ERROR: ('Connection aborted.', gaierror(-2, 'Name or service not known'))
这是 eb init --debug 的输出:
2015-05-06 20:11:37,681 (DEBUG) eb : logging initialized for 'eb' using LoggingLogHandler
2015-05-06 20:11:37,681 (DEBUG) cement.ext.ext_plugin : plugin config dir /etc/eb/plugins.d does not exist.
2015-05-06 20:11:37,681 (DEBUG) cement.ext.ext_plugin : plugin config dir /home/ec2-user/.eb/plugins.d does not exist.
2015-05-06 20:11:37,684 (DEBUG) eb : collecting arguments/commands for <ebcli.core.base.EbBaseController object at 0x7f5877138ed0>
2015-05-06 20:11:37,690 (DEBUG) eb : collecting arguments/commands for <ebcli.controllers.initialize.InitController object at 0x7f587714fa10>
-- EBCLI Version: 3.3.2
-- Python Version: 2.7.9 (default, Apr 1 2015, 18:18:03)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)]
2015-05-06 20:11:37,696 (DEBUG) ebcli.core.fileoperations : Project root found at: /home/ec2-user/awsebtutorial
2015-05-06 20:11:37,697 (DEBUG) ebcli.core.fileoperations : Project root found at: /home/ec2-user/awsebtutorial
2015-05-06 20:11:37,697 (DEBUG) ebcli.core.fileoperations : Project root found at: /home/ec2-user/awsebtutorial
2015-05-06 20:11:37,697 (DEBUG) ebcli.core.fileoperations : Project root found at: /home/ec2-user/awsebtutorial
2015-05-06 20:11:37,697 (DEBUG) ebcli.core.fileoperations : Project root found at: /home/ec2-user/awsebtutorial
2015-05-06 20:11:37,698 (DEBUG) ebcli.core.fileoperations : Project root found at: /home/ec2-user/awsebtutorial
2015-05-06 20:11:37,698 (DEBUG) ebcli.core.fileoperations : Project root found at: /home/ec2-user/awsebtutorial
2015-05-06 20:11:37,698 (DEBUG) ebcli.core.fileoperations : Project root found at: /home/ec2-user/awsebtutorial
2015-05-06 20:11:37,699 (DEBUG) ebcli.core.fileoperations : Project root found at: /home/ec2-user/awsebtutorial
2015-05-06 20:11:37,699 (DEBUG) ebcli.core.fileoperations : Project root found at: /home/ec2-user/awsebtutorial
2015-05-06 20:11:37,699 (DEBUG) ebcli.lib.elasticbeanstalk : Inside get_available_solution_stacks api wrapper
2015-05-06 20:11:37,699 (DEBUG) ebcli.lib.aws : Creating new Botocore Session
2015-05-06 20:11:37,699 (DEBUG) ebcli.lib.aws : Botocore version: 0.93eb
2015-05-06 20:11:37,701 (DEBUG) ebcli.lib.aws : Creating new Botocore Client for elasticbeanstalk
2015-05-06 20:11:37,702 (DEBUG) ebcli.lib.elasticbeanstalk : Inside get_available_solution_stacks api wrapper
2015-05-06 20:11:37,702 (DEBUG) ebcli.lib.aws : Creating new Botocore Session
2015-05-06 20:11:37,702 (DEBUG) ebcli.lib.aws : Botocore version: 0.93eb
2015-05-06 20:11:37,703 (DEBUG) ebcli.lib.aws : Creating new Botocore Client for elasticbeanstalk
2015-05-06 20:11:37,742 (DEBUG) ebcli.lib.aws : Successfully created session for elasticbeanstalk
2015-05-06 20:11:37,742 (DEBUG) ebcli.lib.aws : Making api call: (elasticbeanstalk, list_available_solution_stacks) to region: default with args:{}
2015-05-06 20:11:50,679 (ERROR) ebcli.lib.aws : Error while contacting Elastic Beanstalk Service
2015-05-06 20:11:50,679 (DEBUG) ebcli.lib.aws : error:('Connection aborted.', gaierror(-2, 'Name or service not known'))
Traceback (most recent call last):
File "/usr/local/bin/eb", line 9, in <module>
load_entry_point('awsebcli==3.3.2', 'console_scripts', 'eb')()
File "/usr/local/lib/python2.7/site-packages/ebcli/core/ebcore.py", line 144, in main
app.run()
File "/usr/local/lib/python2.7/site-packages/cement/core/foundation.py", line 694, in run
self.controller._dispatch()
File "/usr/local/lib/python2.7/site-packages/cement/core/controller.py", line 455, in _dispatch
return func()
File "/usr/local/lib/python2.7/site-packages/cement/core/controller.py", line 461, in _dispatch
return func()
File "/usr/local/lib/python2.7/site-packages/ebcli/core/abstractcontroller.py", line 57, in default
self.do_command()
File "/usr/local/lib/python2.7/site-packages/ebcli/controllers/initialize.py", line 59, in do_command
self.set_up_credentials()
File "/usr/local/lib/python2.7/site-packages/ebcli/controllers/initialize.py", line 133, in set_up_credentials
profile = self.check_credentials(profile)
File "/usr/local/lib/python2.7/site-packages/ebcli/controllers/initialize.py", line 122, in check_credentials
return self.check_credentials(profile)
File "/usr/local/lib/python2.7/site-packages/ebcli/controllers/initialize.py", line 107, in check_credentials
initializeops.credentials_are_valid()
File "/usr/local/lib/python2.7/site-packages/ebcli/operations/initializeops.py", line 24, in credentials_are_valid
elasticbeanstalk.get_available_solution_stacks()
File "/usr/local/lib/python2.7/site-packages/ebcli/lib/elasticbeanstalk.py", line 234, in get_available_solution_stacks
result = _make_api_call('list_available_solution_stacks')
File "/usr/local/lib/python2.7/site-packages/ebcli/lib/elasticbeanstalk.py", line 38, in _make_api_call
**operation_options)
File "/usr/local/lib/python2.7/site-packages/ebcli/lib/aws.py", line 256, in make_api_call
raise ServiceError(error)
ebcli.objects.exceptions.ServiceError: ('Connection aborted.', gaierror(-2, 'Name or service not known'))
有人知道我如何解决这个错误吗?
最佳答案
我的猜测是您的 aws 配置文件中的区域无效。
运行 eb init -i
并选择一个区域。
您说运行 aws configure
会给您一个“找不到解决方案堆栈”错误,这意味着您没有权限。看起来您是直接在 ec2 实例上使用 cli。为了在 ec2 实例上获得正确的权限,您需要使用 IAM 将权限添加到实例配置文件中。
关于python - AWS Elastic BeanStalk "eb init"错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30086691/