python - 使用 Boto 启动已停止的 EC2 实例

标签 python amazon-web-services amazon-ec2 boto

我正在编写一个 python 脚本来启动当前已停止的特定实例,但我对如何执行此操作感到困惑。据我了解Boto EC2 introduction在启动实例时,这会创建一个全新的实例吗?

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

非常欢迎代码示例!

最佳答案

我完全错过了 this command in the API

为了将来引用,这是启动已停止实例的方法:

instance = conn.get_all_instances(instance_ids=['instance_id'])
print instance[0].instances[0].start()

关于python - 使用 Boto 启动已停止的 EC2 实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16335181/

相关文章:

python - PyQt 从 excel 填充 QTableWidget

angular - AWS Cognito : Missing 'get' method for AWS. config.credentials

linux - 如何在 Amazon Linux 服务器上升级到 Java 1.8?

amazon-web-services - AWS 负载均衡器的 A(主机)记录

amazon-s3 - AWS EC2 上的 Hbase

python - 用于存储嵌套框的数据结构?

python - 如何将 html 作为变量从 python Flask 传递到 html 中?

python - TensorFlow:CentOS 上的二进制安装错误

linux - Ubuntu 18 上的 nginx 网站未在公共(public) IP 上加载

python - 在 python 中,如何从 Google App Engine 应用程序中启动 Amazon EC2 实例?