The instance termination policy API is used for controlling how Elastigroup will terminate the instances during scale-down operation.
Supported termination policies are:
- Newest Instances
Few more useful features related to termination process:
- Detach instances
You can also decide which instance to terminate manually by using the detach option.
- Lock instances
If you have some instances that are running jobs and you don’t want to terminate them you can also use the lock/protect option.
- Unlock instances
Release the instance from the protection is to Unlock it.
Instance lock enables you to protect specific instance from termination.
Spotinst default termination policy implements smart algorithm to decide which instances will be picked as candidate for termination during scale down.
We are taking into consideration the following parameters:
1. Healthiness of the instance
Unhealthy instances will be terminated before healthy ones.
2. Spot availability prediction
Spotinst continuously monitors and predicts spot markets performance.
We prefer to terminate first instances from volatile markets so we could keep instances in stable and better markets.
3. Strategy questions – how many reserved instances, how many on demand instances etc.
According to defined strategy on Elastigroup, we check if On-Demand count was set – we won’t terminate them.
We prefer to terminate first the spot instances before RIs and ODs.
4. AMI status
Prefer to scale down first the instances with older AMI version.
5. Time considerations (Newest vs Oldest)
Like AMi status – we are checking instance uptime. prefer to terminate first the oldest instances.
We put some weights on each of the parameters above and react accordingly.
Our algorithm assigning weights on each of the parameters stated above, calculating accordingly and decides which instances will be terminated first.
Newest Instance Policy
Terminate the newest instance in the group.
using newest instances policy enables you to extend as much possible the functional and stable instances.
“if it works – don’t disturb it”
Also, it can be useful when you’re testing a new launch configuration but don’t want to keep it in production.