[英]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. 我正在编写一个python脚本,它启动一个当前停止的特定实例,我对我如何做到这一点感到困惑。 As far as I can understand from the Boto EC2 introduction on launching instances this creates a completely new instance?
据我所知, Boto EC2在启动实例方面的介绍会创建一个全新的实例?
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! 代码示例非常受欢迎!
I had completely missed this command in the API 我在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()
You can now start multiple instances in one start_instances
call, eg: 您现在可以在一个
start_instances
调用中启动多个实例,例如:
conn.start_instances(instance_ids=['instance_id_1', 'instance_id_2',])
See http://boto.cloudhackers.com/en/latest/ref/ec2.html#boto.ec2.connection.EC2Connection.start_instances 请参阅http://boto.cloudhackers.com/en/latest/ref/ec2.html#boto.ec2.connection.EC2Connection.start_instances
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.