How to change instance type at runtime

how to change instance type at runtime

I have a t2.small instance, I slipped the instance and started it with the t2.medium instance, but the instance started by t2.small

ec2: key_name: "{{key_name}}" region: "{{aws_region}}" state: running instance_type: t2.medium instance_ids: "{{ item.id }}" aws_access_key: "{{aws_access_key_id}}" aws_secret_key: "{{aws_secret_access_key}}" 

it seems that ansible ignore from instance_type

+5
source share
2 answers

You canโ€™t just start your instance using the new size, you first need to resize your instance, after it stops, and then start it later.

Resize your instance [link]

 ec2-modify-instance-attribute <instance id> --instance-type <new type> 

You should also take note of this , in particular>

You can only resize an instance if its current instance type and the new instance type you want are compatible in the following ways:

  • Type of virtualization. Linux AMIs use one of two types of virtualization: paravirtual (PV) or hardware virtual machine (HVM). You cannot resize an instance that was started with PV AMI, until the instance type, only HVM. See Linux AMI Virtualization Types for more information.
  • Network. Some instance types are not supported in EC2-Classic and must be running in VPC. Therefore, you cannot resize an instance in EC2-Classic to an instance type that is only available in VPC unless you have an insecure VPC. For more information, see Instance Types Available Only in VPC.
  • Platform. All Amazon EC2 instance types support 64-bit AMI, but only the following instance types support 32-bit AMI: t2.nano, t2.micro, t2.small, t2.medium, c3.large, t1.micro, m1.small, m1.medium and c1.medium. If you are resizing a 32-bit instance, you are limited to these types of instances.
+1
source

Command

aws ec2 modify-instance-attribute -instance-id i-0a83c51db11ca537f - state type t2.micro

Further information can be found at http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-resize.html

0
source

Source: https://habr.com/ru/post/1244512/


All Articles