简体   繁体   中英

Specific Auto-Scaling group Cloudformation AWS

I have an auto scaling group in AWS so i can change stack size of instances created by CF. However when i want to reduce the stack it will terminate random instances in the stack.

I need to know if its possible to reduce stack size in CF but leave specific instances in the stack running using the scaling group?

      "WebServerScaleUpPolicy" : {
  "Type" : "AWS::AutoScaling::ScalingPolicy",
  "Properties" : {
    "AdjustmentType" : "ChangeInCapacity",
    "AutoScalingGroupName" : { "Ref" : "AutoScalingServerGroup" },
    "Cooldown" : "60",
    "ScalingAdjustment" : "1"
  }
},
"WebServerScaleDownPolicy" : {
  "Type" : "AWS::AutoScaling::ScalingPolicy",
  "Properties" : {
    "AdjustmentType" : "ChangeInCapacity",
    "AutoScalingGroupName" : { "Ref" : "AutoScalingServerGroup" },
    "Cooldown" : "60",
    "ScalingAdjustment" : "-1"
  }
}

Any Help Appreciated.

Look into instance scale-in protection, as detailed in this AWS blog post.

I don't use CloudFormation so I'm not sure of the level of support it has for Autoscaling customisation, but this post has a workaround that may work for you.

Look into Amazon EC2 Auto Scaling Lifecycle Hooks . As you'll see below, instance can be notified of the Scale In event and either prepare for termination or straight up cancel the scaling event.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM