如何更改aws-ec2实例类型? [英] How to change aws-ec2 instance type?

查看:908
本文介绍了如何更改aws-ec2实例类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Boto3更改aws-ec2实例类型(例如,从微型更改为大型,反之亦然,等等)。
更改ec2-instances的实例类型时需要注意哪些因素。
这是我的代码:

I wanted to change the aws-ec2 instance type(e.g from micro to large or vice-versa etc) using Boto3. What are the factors that needs to be care while changing the instance type of ec2-instances. Here is my code:

    def get_ec2_boto3_connection(region, arn):
        sess = Boto3Connecton.get_boto3_session(arn)
        ec2_conn = sess.client(service_name='ec2', region_name=region)
        return ec2_conn

    def change_instance_type(arn,region):
          ec2_conn=get_ec2_boto3_connection(region,arn)
          ec2_conn.modify_instance_attribute(InstanceId=id,Attribute='instanceType'InstanceType={
    'Value': 'm4.large'
})

在更改ec2实例的实例类型之前需要注意的责任因素是什么?

What are the accountable factors,to be taken care of before changing the instance type of an ec2 instance?

推荐答案

请参阅: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-resize.html

基本上,这取决于它是ebs支持还是实例存储。
您只能调整ebs支持的实例的大小(例如store-您需要启动一个新实例,迁移,拆除旧的isntace)。
,在尝试调整大小之前还需要解决一些兼容性问题

basically it depends if it's ebs backed or instance store. you can only resize ebs backed instances (for instance store - you need to spin up a new instance, migrate, tear down old isntace). there are also compatibility issues that you need to make are satisfied before attempting a resize

这篇关于如何更改aws-ec2实例类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆