Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Wait until the instance is running before assigning the elastic IP to…

… it. Otherwise you get an EC2 InvalidInstanceId error with a message like the following:

The instance 'i-3b367653' is not in the 'running' state
  • Loading branch information...
commit 46b4d1c2bbf63fa551daa45469a3ebbb5c091346 1 parent 56b5a5d
walsh159 authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 boto/manage/server.py
View
5 boto/manage/server.py
@@ -318,7 +318,10 @@ def create(cls, config_file=None, logical_volume = None, cfg = None, **params):
elastic_ip = params.get('elastic_ip')
instances = reservation.instances
if elastic_ip != None and instances.__len__() > 0:
- instances[0].use_ip(elastic_ip)
+ instance = instances[0]
+ while instance.update() != 'running':
+ time.sleep(1)
+ instance.use_ip(elastic_ip)
print 'set the elastic IP of the first instance to %s' % elastic_ip
for instance in instances:
s = cls()
Please sign in to comment.
Something went wrong with that request. Please try again.