Auto Scale Resources
Cloud provider Auto Scale groups are scalable cloud resources that launch and manage one or more servers instances. An Auto Scale group defines a desired state of how many server instances should be active. It then drives the actual state to match that desired state.
PowerDown fully supports native Auto Scale groups and augments the cloud provider functionality with the ability to support and manage Spot instances. PowerDown also provides the ability to override the Auto Scale capacity min/max/desired parameters in response to a power up and down event. PowerDown Auto Scale can have multiple schedules attached to define whether the group should be powered up or down at any given time.
PowerDown will manage Auto Scale groups and migrate workloads from On-Demand servers onto Spot instances if desired. You can configure the required number or percentage of Spot instances for each Auto Scale group. You can alternatively specify the number or percentage of On-Demand servers and PowerDown will convert the remainder to Spot instances.
To ensure in-flight requests are completed without interruption when transitioning from an On-Demand instance to a Spot instance, you can specify a "Drain Delay" which is the time in seconds to wait after detaching an instance from the Auto Scale group before it is terminated.
Powering Up and Down
When an Auto Scale group is powered down, the server instance count will be set to the defined minimum value of the group. When the group is powered up, the instance count will be set to the defined maximum count. These values are defined when you create the Auto Scale group with your cloud provider.
If you are using PowerDown for Spot Management, it is recommended that you set the "maximum" value to be greater than "desired" parameter value. This means that the PowerDown will not then need to temporarily boost the maximum value when attaching new Spot instances to the group.
When in a powered down state, an Auto Scale group would by default set the desired instance count to the minimum value which is typically set to zero. However, you can override this and define a non-zero number of instances when powered-down to enable a "low-power" mode such that the Auto Scale group is still available when powered down, but at a reduced capacity.
For Power Up and Down configurations, you can also specify the number or percentage of On-Demand or Spot instances you require.
If you modify the Auto Scale parameters externally via the AWS console, CLI or API when the Auto Scale group is powered up, then PowerDown will update the "Powered Up" parameters using the AWS updated values. This supports use cases such as code deploys using the Terraform tool.
You can also specify different launch configurations to use for powered up and powered down states. In this way, you can select smaller, cheaper server instances to use when powered-down and more powerful instances when powered up.
Use a "config:" prefix to specify a Launch Configuration and a "template:" prefix to specify a Launch Template.
Note: existing instances will not be re-created when transitioning from a powered down to a powered up state. Only the new instances will use the launch configuration when powering up.
If using the Terraform tool, don't set the Auto Scale Group desired parameter. If you leave this unset any existing value will be preserved. If a value is not defined for "desired", Auto Scale will use the maximum value by default. By leaving desired unset in your Terraform rules, you can deploy/apply with Terraform and not change any desired values you are updating via PowerDown or other tools.