Configure an auto provisioning group to create ECS instances across resource pools for scenarios such as machine learning and web services.
Configure in the ECS console
Example 1: Implement machine learning
You plan to complete a week-long machine learning task that analyzes risk factors in mortgage loans. The instance cluster must meet the following requirements:
-
Region: China (Hangzhou).
-
Instances use NVIDIA V100 GPUs with up to 32 GB of GPU memory per instance.
-
Target capacity: 20 instances.
-
To minimize costs, create only spot instances. The cluster size can be less than the target capacity.
-
Release instances after the task completes.
The following table lists the auto provisioning group settings for this scenario.
|
Section |
Parameter |
Description |
|
Capacity Configuration |
Target Capacity |
Set the target capacity:
|
|
Instance Configuration |
Instance Configuration |
Select instance types with NVIDIA V100 GPUs and up to 32 GB of GPU memory:
Add instance configurations by zone and instance type:
These configurations produce the following resource pools:
|
|
Provisioning Policy |
Select Cost Optimization Policy. The group creates instances from the lowest-priced resource pool. |
|
|
Spot Instance Interruption Settings |
Select Release. The cluster size can fall below the target capacity to minimize costs. |
|
|
Advanced |
Group Type |
Select One-time Delivery. The cluster size can fall below the target capacity to minimize costs. |
|
Start Time and End Time |
Set the start time and expiration time to cover the next week. |
|
|
Global Maximum Price for Spot Instances |
Select Set Maximum Price and specify your maximum acceptable price. |
|
|
Instance Shutdown Settings |
|
Example 2: Build a ticketing website
You want to build a ticketing website that provides reliable service at all hours, especially during peak hours. The instance cluster must meet the following requirements:
-
Region: China (Hangzhou).
-
Each instance has no more than 8 vCPUs.
-
Target capacity: 80 vCPUs.
-
Minimum capacity: 60 vCPUs.
-
Optimize access experience at minimum cost based on the minimum capacity.
-
The cluster must support disaster recovery.
The following table lists the auto provisioning group settings for this scenario.
|
Section |
Parameter |
Description |
|
Capacity Configuration |
Target Capacity |
Set the target and minimum capacity:
|
|
Pay-as-you-go Instance Capacity |
Enter 60 to meet the minimum capacity requirement. |
|
|
Instance Configuration |
Instance Configuration |
The c6 instance family suits frontend web servers. Select instance types with no more than 8 vCPUs:
Add instance configurations by zone and instance type:
These configurations produce the following resource pools:
|
|
Provisioning Policy |
Select Balanced Distribution Policy. The group evenly distributes instances across zones to improve disaster recovery. |
|
|
Instance Configuration |
Spot Instance Interruption Settings |
Select Stop to ensure low-latency website access. Recovering a stopped instance in economical mode is faster than creating a new instance. |
|
Advanced |
Group Type |
Select Continuous Delivery and Maintain Capacity for uninterrupted ticketing service. |
|
Start Time and End Time |
The group starts immediately and runs indefinitely for continuous ticketing service. |
|
|
Global Maximum Price for Spot Instances |
Select Automatic Bidding to maintain a stable instance count for optimal access experience. |
|
|
Instance Shutdown Settings |
Select Shut Down Excessive Instances When Target Capacity Is Exceeded to minimize costs. |
The target capacity uses vCPUs, so each instance type's weight equals its vCPU count. The following table shows the weighted price of each instance type.
Prices in the following table are for reference only. Actual prices on the buy page prevail.
|
Instance type |
vCPUs |
Pay-as-you-go price (USD) |
Weight |
Weighted price (USD) |
|
ecs.c6.large |
2 |
0.06 per hour |
2 |
0.03 per hour |
|
ecs.c6.xlarge |
4 |
0.121 per hour |
4 |
0.03025 per hour |
|
ecs.c6.2xlarge |
8 |
0.241 per hour |
8 |
0.030125 per hour |
The group first applies the balanced distribution policy to evenly distribute instances across zones, then selects instance types with lower weighted prices. If weighted prices are equal, instance types are chosen at random.
Configure by calling an API operation
Example 1: Use multiple resource pools with the lowest prices
To minimize costs and reduce the impact of spot instance reclamation from a single resource pool, configure the group to use multiple lowest-priced resource pools.
Call the CreateAutoProvisioningGroup operation with SpotAllocationStrategy set to lowest-price and SpotInstancePoolsToUseCount specified. The following example creates a group with these results:
-
Obtain five resource pools based on the lt-bp1ivgo4p5now3px**** launch template.
-
Set the target capacity to 30 instances, all spot instances.
-
Use the three lowest-priced resource pools, creating 10 spot instances from each.
|
Parameter |
Example |
Description |
|
TotalTargetCapacity |
30 |
Sets the target capacity to 30 instances. |
|
SpotTargetCapacity |
30 |
Creates 30 spot instances. |
|
PayAsYouGoTargetCapacity |
0 |
Creates no pay-as-you-go instances. |
|
SpotAllocationStrategy |
lowest-price |
Uses the cost optimization policy for spot instances. |
|
PayAsYouGoAllocationStrategy |
lowest-price |
Uses the cost optimization policy for pay-as-you-go instances. |
|
SpotInstancePoolsToUseCount |
3 |
Uses the three lowest-priced resource pools. |
|
LaunchTemplateId |
lt-bp1ivgo4p5now3px**** |
The launch template ID. |
|
LaunchTemplateConfig.1.VSwitchId |
vsw-bp1ygryo03m39xhsy**** |
The vSwitch ID of extended configuration 1 (Resource Pool 1). |
|
LaunchTemplateConfig.1.InstanceType |
ecs.c6e.large |
The instance type of extended configuration 1 (Resource Pool 1). |
|
LaunchTemplateConfig.1.WeightedCapacity |
1 |
The weight of extended configuration 1 (Resource Pool 1). |
|
LaunchTemplateConfig.2.VSwitchId |
vsw-bp16hgf8f3kvtcbyu**** |
The vSwitch ID of extended configuration 2 (Resource Pool 2). |
|
LaunchTemplateConfig.2.InstanceType |
ecs.c6e.xlarge |
The instance type of extended configuration 2 (Resource Pool 2). |
|
LaunchTemplateConfig.2.WeightedCapacity |
1 |
The weight of extended configuration 2 (Resource Pool 2). |
|
LaunchTemplateConfig.3.VSwitchId |
vsw-bp1oeawdo9tj2gvjp**** |
The vSwitch ID of extended configuration 3 (Resource Pool 3). |
|
LaunchTemplateConfig.3.InstanceType |
ecs.c6e.2xlarge |
The instance type of extended configuration 3 (Resource Pool 3). |
|
LaunchTemplateConfig.3.WeightedCapacity |
1 |
The weight of extended configuration 3 (Resource Pool 3). |
|
LaunchTemplateConfig.4.VSwitchId |
vsw-bp1oeawdo9tj2gvjp**** |
The vSwitch ID of extended configuration 4 (Resource Pool 4). |
|
LaunchTemplateConfig.4.InstanceType |
ecs.g6e.xlarge |
The instance type of extended configuration 4 (Resource Pool 4). |
|
LaunchTemplateConfig.4.WeightedCapacity |
1 |
The weight of extended configuration 4 (Resource Pool 4). |
|
LaunchTemplateConfig.5.VSwitchId |
vsw-bp1oeawdo9tj2gvjp**** |
The vSwitch ID of extended configuration 5 (Resource Pool 5). |
|
LaunchTemplateConfig.5.InstanceType |
ecs.g6e.2xlarge |
The instance type of extended configuration 5 (Resource Pool 5). |
|
LaunchTemplateConfig.5.WeightedCapacity |
1 |
The weight of extended configuration 5 (Resource Pool 5). |
Example 2: Preferentially use a specific resource pool
Configure the group to prioritize a specific resource pool. For example, if you use reserved instances applicable to ecs.c6e.large instances, prioritize ecs.c6e.large to benefit from reserved instance discounts.
Call the CreateAutoProvisioningGroup operation with PayAsYouGoAllocationStrategy set to prioritized and the target resource pool's priority set to 0 (highest). The following example creates a group with these results:
-
Obtain five resource pools based on the lt-bp1ivgo4p5now3px**** launch template.
-
Set the target capacity to 20 instances: 10 spot and 10 pay-as-you-go.
-
Use the ecs.c6e.large resource pool (LaunchTemplateConfig.1) for pay-as-you-go instances.
|
Parameter |
Example |
Description |
|
TotalTargetCapacity |
20 |
Sets the target capacity to 20 instances. |
|
SpotTargetCapacity |
10 |
Creates 10 spot instances. |
|
PayAsYouGoTargetCapacity |
10 |
Creates 10 pay-as-you-go instances. |
|
SpotAllocationStrategy |
lowest-price |
Uses the cost optimization policy for spot instances. |
|
PayAsYouGoAllocationStrategy |
prioritized |
Uses the priority-based policy for pay-as-you-go instances. |
|
LaunchTemplateId |
lt-bp1ivgo4p5now3px**** |
The launch template ID. |
|
LaunchTemplateConfig.1.VSwitchId |
vsw-bp1ygryo03m39xhsy**** |
The vSwitch ID of extended configuration 1 (Resource Pool 1). |
|
LaunchTemplateConfig.1.InstanceType |
ecs.c6e.large |
The instance type of extended configuration 1 (Resource Pool 1). |
|
LaunchTemplateConfig.1.WeightedCapacity |
1 |
The weight of extended configuration 1 (Resource Pool 1). |
|
LaunchTemplateConfig.1.Priority |
0 |
The priority of extended configuration 1. 0 indicates the highest priority. |
|
LaunchTemplateConfig.2.VSwitchId |
vsw-bp16hgf8f3kvtcbyu**** |
The vSwitch ID of extended configuration 2 (Resource Pool 2). |
|
LaunchTemplateConfig.2.InstanceType |
ecs.c6e.xlarge |
The instance type of extended configuration 2 (Resource Pool 2). |
|
LaunchTemplateConfig.2.WeightedCapacity |
1 |
The weight of extended configuration 2 (Resource Pool 2). |
|
LaunchTemplateConfig.3.VSwitchId |
vsw-bp1oeawdo9tj2gvjp**** |
The vSwitch ID of extended configuration 3 (Resource Pool 3). |
|
LaunchTemplateConfig.3.InstanceType |
ecs.c6e.2xlarge |
The instance type of extended configuration 3 (Resource Pool 3). |
|
LaunchTemplateConfig.3.WeightedCapacity |
1 |
The weight of extended configuration 3 (Resource Pool 3). |
|
LaunchTemplateConfig.4.VSwitchId |
vsw-bp1oeawdo9tj2gvjp**** |
The vSwitch ID of extended configuration 4 (Resource Pool 4). |
|
LaunchTemplateConfig.4.InstanceType |
ecs.g6e.xlarge |
The instance type of extended configuration 4 (Resource Pool 4). |
|
LaunchTemplateConfig.4.WeightedCapacity |
1 |
The weight of extended configuration 4 (Resource Pool 4). |
|
LaunchTemplateConfig.5.VSwitchId |
vsw-bp1oeawdo9tj2gvjp**** |
The vSwitch ID of extended configuration 5 (Resource Pool 5). |
|
LaunchTemplateConfig.5.InstanceType |
ecs.g6e.2xlarge |
The instance type of extended configuration 5 (Resource Pool 5). |
|
LaunchTemplateConfig.5.WeightedCapacity |
1 |
The weight of extended configuration 5 (Resource Pool 5). |