Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starting a stopped EC2 instance with Boto

I am writing a python script that starts a specific instance that is currently stopped, and I am kind of stumped on how I'd do that. As far as I can understand from the Boto EC2 introduction on launching instances this creates a completely new instance?

conn.run_instances(
    '<ami-image-id>',
    key_name='myKey',
    instance_type='c1.xlarge',
    security_groups=['your-security-group-here'])

Code examples would be very welcome!

like image 906
mackwerk Avatar asked May 02 '13 09:05

mackwerk


1 Answers

I had completely missed this command in the API

For future reference, this is how to start a stopped instance:

instance = conn.get_all_instances(instance_ids=['instance_id'])
print instance[0].instances[0].start()
like image 189
mackwerk Avatar answered Sep 23 '22 01:09

mackwerk