dimanche 9 août 2015

How to change aws-ec2 instance type?

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'
})

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




Aucun commentaire:

Enregistrer un commentaire