amazon rds - Create a rds instance using python: having status always = creating -
im trying create rds instance using python.
i have code below create instance , want show print "instance running" when instance have status available.
the problem that, when appears available status in aws managment console, in console application still appears status = creating , code dont out of while loop:
the result im having:
.... creating 233 creating 234 ...
the code:
instance = conn.create_dbinstance(...) print "waiting instance , running" status = instance.status inc = 0 while status != 'available': sleep(5) status = instance.status print status inc=inc +1 print inc if status == 'available': print "instance running"
do see why can happening?
the boto docs aren't clear when results such dbinstance.status fetched on-demand via api vs. being returned earlier, cached lookup. i'm betting here, instance.status call using returning same (cached) result each time.
try
status = conn.get_all_dbinstances(instance_id=instance.id)[0].status
instead of
status = instance.status
inside while loop.
Comments
Post a Comment