AWS - Auto Scaling Groups

最後更新: 2021-09-09

Features

  • scaling policies(Manual Dynamic Predictive Scheduled)
  • health check replacements

 


Scaling policies

If an instance becomes unhealthy,

the group terminates the unhealthy instance and launches another instance to replace it.

Health check replacements

When the scaling policy is in effect, the Auto Scaling group adjusts the desired capacity of the group,

between the minimum and maximum capacity values that you specify, and launches or terminates the instances as needed.

 


Launch template

 

 * 將會取締 "Launch Configurations"

 * support versioning

To create a launch template

EC2 console > On the navigation pane, under INSTANCES > choose Launch Templates.

 


Auto-assign Public IP

 

Auto Scaling > Launch configurations 內設定

由於沒有 "Edit", 所以要 "Copy" 成新 config 才修改到,

過程中展開 "Advanced details" 再修改 Public IP address type
 


Start instance refresh

 

使用情況: a new Amazon Machine Image (AMI) or a new user data script.

Replace 的過程

Each instance is terminated first and then replaced

Minimum healthy percentage

This is the amount of capacity in an Auto Scaling group that must pass your health checks during an instance refresh so that the refresh can continue.

For example, if the minimum healthy percentage is 90 percent,
then 10 percent is the percentage of capacity that will be terminated and replaced.

To replace one instance at a time, set a minimum healthy percentage of 100 percent.
To replace all at once, set a minimum healthy percentage of 0 percent.

當 Desired 係 2, Minimum healthy 0% 時

2 Terminating (舊 instance)
2 InService (新 instance)

Skip matching

When an instance matches your desired "launch template"G and any instance type overrides, it is not replaced

Checkpoints

A point in time where the instance refresh pauses for a specified amount of time.
If you don't use checkpoints, rolling replacements are performed continuously.
An instance refresh can contain multiple checkpoints.
After a certain percentage of the group is replaced, a checkpoint is reached.
Whenever there is a checkpoint, Amazon EC2 Auto Scaling temporarily stops replacing instances and sends a notification.
Then, it waits for the amount of time you specified before continuing.
After you receive the notification, you can verify that your new instances are working as expected.

GUI 會見到

  • Status
  • 0%
  • 2 instances left to update
  • Start time & End time