简体   繁体   English

当实例连接到自动扩展组时,AWS EC2 如何更改实例类型?

[英]AWS EC2 how to change instance type when the instance is connected to an autoscaling group?

I'm getting puzzled by this,我对此感到困惑,

I need to increase the specs of an EC2 instance and following this tutorial: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-resize.html#change-instance-type-of-ebs-backed-instance我需要增加 EC2 实例的规格并遵循本教程: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-resize.html#change-instance-type-of-ebs -支持的实例

but it appears that the instance is connected to an autoscaling group, so as soon as I stop it another one is spawn, and the one I stopped is terminated, so I can't change its type.但似乎该实例已连接到一个自动缩放组,因此一旦我停止它,就会产生另一个实例,而我停止的实例已终止,因此我无法更改其类型。

I tried detatching the instance from the autoscaling group, but it doesn't do it because there needs to be at least one.我尝试从自动缩放组中分离实例,但它没有这样做,因为至少需要一个。

and if I change the minimum capacity it actually also terminates it and can't update its type.如果我更改最小容量,它实际上也会终止它并且无法更新它的类型。

how can I change the instance type of this EC2 box?如何更改此 EC2 框的实例类型?

Try creating a new launch configuration with the new ami and point the auto scaling group to use it尝试使用新的 ami 创建新的启动配置,并指向 Auto Scaling 组以使用它

EDIT:编辑:

Try following this: https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-template.html尝试以下操作: https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-template.html

Auto Scaling groups have either a Launch Template or Launch Configuration attached to them. Auto Scaling 组具有附加的启动模板启动配置 These specify what kind of properties have the instances which are launched by the auto scaling group.这些指定哪些属性具有由 Auto Scaling 组启动的实例。

If you want to modify the type of an instance controlled by an ASG, you have to update the Launch Configuration/Launch Template.如果要修改由 ASG 控制的实例的类型,则必须更新启动配置/启动模板。 Afterwards, you can terminate the running instances one by one, the auto scaling group will relaunch them with the updated properties.之后,您可以逐个终止正在运行的实例,Auto Scaling 组将使用更新的属性重新启动它们。

The correct way to modify the instance size is by changing the Launch Template or Launch Configuration .修改实例大小的正确方法是更改 Launch Template 或 Launch Configuration Note that this will only apply to newly launched instances, not existing instances.请注意,这仅适用于新启动的实例,不适用于现有实例。

If you particularly want to keep an existing instance, you could suspend autoscaling processes with:如果您特别想保留现有实例,可以使用以下命令暂停自动缩放过程

aws autoscaling suspend-processes

Then you can stop/modify/start the instance.然后您可以停止/修改/启动实例。 Then, reactivate processes with:然后,使用以下命令重新激活进程:

aws autoscaling resume-processes

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 aws 自动缩放组 ec2 实例每分钟运行一次脚本 - aws autoscaling group ec2 instance to run script every minute aws 自动缩放组 ec2 实例在销毁之前创建 - aws autoscaling group ec2 instance create before destroy 如何仅在AWS EC2自动缩放组中的一个tomcat实例中启动Web流程 - How to start a web process in only one tomcat instance in AWS EC2 autoscaling group 如何将AWS EC2实例CPU利用率提高到100%以测试自动缩放组创建新实例? - How to increase AWS EC2 instance CPU utilization to 100% to test autoscaling group creating new instances? 终止自动缩放组中的特定 ec2 实例 - Terminate specific ec2 instance in an autoscaling group 如何为使用自动缩放组启动的ec2实例添加文件? - How to add files for the ec2 instance which is launched with autoscaling group? AWS EC2实例:更改类型受限制 - Aws EC2 instance : Change type restricted 当AWS AutoScaling终止EC2实例时,如何在Tomcat上完成长期运行的任务? - How to finish long-running task on Tomcat when AWS AutoScaling is terminating the EC2 instance? 未通过 SSH 连接时无法访问 AWS EC2 实例 URL - AWS EC2 instance URL unreachable when not connected to it by SSH 如何使用Terraform配置AWS自动伸缩组/启动配置以仅在一个EC2实例上运行cron作业? - How can I configure an AWS autoscaling group/launch configuration with Terraform to only run a cron job on one EC2 instance?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM