3

I created an Elastic Beanstalk Environment using the console. Then I logged in to the EB EC2 instance and installed awsebcli:

sudo pip install awsebcli

I configured aws:

aws configure 

and ran "eb init":

eb init

Then I get the following error:

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'))

This is the output of 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'))

Does someone know how I can solve this error?

jjf
  • 115
  • 3
  • 11
  • how does `php` come into play here ? – cmorrissey May 06 '15 at 20:17
  • BTW I ran "aws configure" before "eb init" because if I run "eb init" before "aws configure" I get the same problem as: http://stackoverflow.com/questions/27259915/elastic-beanstalk-could-not-find-any-platforms – jjf May 06 '15 at 20:23
  • cmorrissey, Im trying to make an app in php. Should I remove the php tag? – jjf May 06 '15 at 20:25

1 Answers1

4

My guess is that the region in your aws profile is invalid.

Run eb init -i and select a region.

You said running aws configure gave you a "no solution stacks found" error, which would mean you do not have permissions. It looks like you are using the cli on an ec2 instance directly. In order to get the correct permissions on an ec2 instance you need to add the permissions to the instance profile using IAM.

Nick Humrich
  • 14,905
  • 8
  • 62
  • 85
  • How I can "add the permissions to the instance profile using IAM."? – jjf May 06 '15 at 20:57
  • @jjf Are you the account owner or is your account managed by someone else? Your aws account that is. – Nick Humrich May 06 '15 at 21:49
  • I'm the account owner. – jjf May 06 '15 at 21:55
  • When I click on the ec2 instance in the EC2 dashboard, it says that the instance has "aws-elasticbeanstalk-ec2-role" as its IAM Role. Then I go to IAM Dashboard and click: Roles -> aws-elasticbeanstalk-ec2-role -> Attach Policy-> AWSElasticBeanstalkFullAccess. After these steps, does the ec2 instance has all the permisson needed to use Elastic Bean Stalk? – jjf May 06 '15 at 22:02
  • http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html but use the `AWSElasticBeanstalkFullAccess` policy. – Nick Humrich May 06 '15 at 22:02
  • Yes, adding the policy to the role/profile should do the trick. – Nick Humrich May 06 '15 at 22:02
  • @jjf but not im curious, why are you running the beanstalk CLI on a beanstalk instance? – Nick Humrich May 06 '15 at 22:03
  • Ok. I added the AWSElasticBeanstalkFullAccess policy to aws-elasticbeanstalk-ec2-role using the IAM Dashboard. Then I created a new EB EC2 instance using the EB Dash Board(selected aws-elasticbeanstalk-ec2-role in Permissions).After the instance was created, I selected my region(configuration -> Scaling -> Custom Availability Zones). Now it works!! Thanks Man! – jjf May 06 '15 at 23:22
  • Nick Humrich "why are you running the beanstalk CLI on a beanstalk instance?". Is there an easier way of deploying a web service with multiple php's and html's with Elastic BeanStalk? – jjf May 06 '15 at 23:25
  • @jjf The CLI is the best way to deploy. But my question is why are you deploying from a beanstalk instance to another beanstalk instance? Why dont you just use the CLI and deploy directly from your own machine? – Nick Humrich May 06 '15 at 23:27
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/77134/discussion-between-jjf-and-nick-humrich). – jjf May 06 '15 at 23:41