【AWS】Default Termination Policyとは

The default termination policy uses the following steps to identify an instance to terminate:

  1. Before Auto Scaling selects an instance to terminate, it first identifies the Availability Zone that has more instances than the other Availability Zones used by the group. If all Availability Zones have the same number of instances, it identifies a random Availability Zone.

  2. Within the selected Availability Zone, it identifies the instance that was launched using the oldest launch configuration.

    Auto Scaling calls the DescribeLaunchConfiguration action on the instances in an Auto Scaling group. It then uses the time in the CreatedTime field to identify the instance with the oldest launch configuration.

  3. If more than one running instance was launched using the oldest launch configuration, it identifies the instance within that subset that is closest to the next instance hour.

    By selecting the instance that is closest to the next instance hour, Auto Scaling maximizes the hours your instances run while minimizing the billable instance-hours.

  4. If more than one instance is closest to the next instance hour, it selects a random instance from that subset.

 

1.オートスケールがターミネートするインスタンスを選択する前に、オートスケールグループが使用しているAvailabilityZoneのなかで一番多くのインスタンスを持っているZoneを特定します。もしインスタンス数がZone間で同じであるならば、ランダムでZoneが決められます。

 

2.Zoneが決まったら、最も古いローンチコンフィグファイルを使用してローンチされたインスタンスを特定します。

オートスケールはDescribe Launch Configurationを呼び出します。そしてCreateTimeフィールドの値を使用して一番古いLaunch Configを特定します。

 

3.一つ以上のインスタンスが古いローンチコンフィグを使っていたら、instace hour(課金)に最も近い部分集合を選びます。

それによって、オートスケールは最少の支払額でインスタンスのランニング時間を最大化する

 

4.一つ以上のインスタンスがinstace hour(課金)に最も近い場合、あとはランダム