Python boto ec2 - How do I wait till an image is created or failed

If I understand correctly, you want to initiate the create_image call and then wait until the server-side operation completes before moving on. To do this, you have to poll the EC2 service periodically until the state of the image is either available (meaning it succeeded) or failed (meaning it failed). The code would look something like this:

import time
...
image_id = ec2_conn.create_image(instance.id, ...)
image = ec2_conn.get_all_images(image_ids=[image_id])[0]
while image.state == 'pending':
    time.sleep(5)
    image.update()
if image.state == 'available':
    # success, do something here
else:
    # handle failure here