You can create scaling groups that contain elastic container instances in the Auto Scaling console. To minimize costs and manage applications deployed on elastic container instances in a simplified manner, you can enable the cost optimization feature of Auto Scaling to automatically scale elastic container instances. This topic describes how to enable the cost optimization feature for scaling groups that contain elastic container instances. This topic also describes the benefits of the cost optimization feature.
Background information
Scaling groups that contain Elastic Compute Service (ECS) instances and scaling groups that contain elastic container instances have several features in common, such as the event-triggered task, lifecycle hook, rolling update, and notification features. For more information, see Compare the features of different types of scaling groups. Scaling groups that contain elastic container instances have several exclusive features, such as image cache and cost optimization features. This topic describes the cost optimization feature.
Billing principles
- If a specified ECS instance type meets your requirements and the price of the ECS instance type is lower than the unit price of elastic container instances, Auto Scaling uses the ECS instance type to create elastic container instances. The elastic container instances are billed based on the price of the ECS instance type. In this case, the cost optimization feature takes effect.
- If no specified ECS instance type meets your requirements or the price of the ECS instance type that you specified is greater than the unit price of elastic container instances, Auto Scaling does not use the ECS instance type to create elastic container instances. Auto Scaling creates elastic container instances based on vCPU and memory specifications. The elastic container instances are billed based on the unit price of the vCPU and memory specifications. In this case, the cost optimization feature does not take effect.
Benefits
- Meets many business requirements: For example, if your business does not require high instance performance, you can deploy your application on elastic container instances of the shared instance type or on burstable instances to reduce resource costs.
- Minimizes costs: Auto Scaling creates elastic container instances of the specified ECS instance type. In this case, you can enjoy the benefits of reserved instances and savings plans. For more information, see "Cost optimization" in the Billing section of elastic container instances.
Procedure
Verify the results
The following figures show the difference between the scale-out results of the scaling group for which the cost optimization feature is disabled and the scaling group for which the cost optimization feature is enabled.
- If you apply the scaling configuration in which the cost optimization feature is disabled
to a scaling group or the cost optimization feature does not take effect, Auto Scaling
does not use the specified ECS instance type to create elastic container instances
in the scaling group.
- If you apply the scaling configuration in which the cost optimization feature is enabled
to a scaling group and the cost optimization feature takes effect, Auto Scaling uses
the specified ECS instance type to create elastic container instances in the scaling
group.
Compare the effects
You can call the DescribeContainerGroupPrice API operation to query the final cost of the elastic container instances that are created by Auto Scaling. In this example, the value of the TradePrice parameter is used as a reference. The value of the TradePrice parameter represents only the cost of the elastic container instances that are created by Auto Scaling in this walkthrough. The cost of elastic container instances for which the cost optimization feature takes effect varies based on your actual configurations.
- If the cost optimization feature is disabled, the value of the TradePrice parameter that is returned is 0.00004085.
- If the cost optimization feature enabled, the value of the TradePrice parameter that is returned is 0.00003387.
In this case, the cost optimization feature reduced the cost of elastic container instances by 17%.