All Products
Search
Document Center

Elastic Compute Service:Auto provisioning group configuration examples

Last Updated:Feb 27, 2026

An auto provisioning group creates and manages a fleet of Elastic Compute Service (ECS) instances across multiple instance types, zones, and pricing models. Use auto provisioning groups to build instance clusters that balance cost, availability, and capacity for workloads such as machine learning and web services.

Choose a configuration strategy

Select the strategy that matches your workload before you configure an auto provisioning group.

ScenarioConfigurationDetails
Optimize for cost-effectiveness and high creation success rate?Capacity Optimization Policy (default)Uses the most cost-effective instance type based on the prices and reclamation rates of spot instances.
Minimize costs across multiple resource pools?Cost Optimization Policy with spot instancesThe auto provisioning group selects the lowest-priced instance type to create instances.
Distribute instances across zones for disaster recovery?Balanced Distribution PolicyThe auto provisioning group evenly creates instances across zones to prevent instance creation failures caused by insufficient resources within a single zone.
Prioritize a specific instance type (for example, to use reserved instances)?Prioritized allocation (PayAsYouGoAllocationStrategy = prioritized)Creates pay-as-you-go instances based on the priority specified by LaunchTemplateConfig.N.Priority.
Use multiple low-cost pools to reduce spot interruption risk?Lowest-price allocation with SpotInstancePoolsToUseCountDistributes spot instances across the N cheapest resource pools instead of concentrating in one.

Core concepts

ConceptDescription
Resource poolA combination of one instance type and one zone. Each pool is an independent source of capacity.
Target capacityThe total capacity goal for the group, measured in instances or vCPUs.
Weighted capacityThe weight assigned to an instance type relative to the target capacity. When target capacity is measured in vCPUs, a 4-vCPU instance type has a weight of 4.
Provisioning policyThe strategy that determines how instances are allocated across resource pools.
Group typeControls whether the group delivers instances once (One-time Delivery) or maintains capacity continuously (Continuous Delivery and Maintain Capacity).

Spot instance interruption handling

When a spot instance is reclaimed, the auto provisioning group handles it based on the Spot Instance Interruption Settings that you select.

SettingBehaviorRecovery timeCost after interruption
ReleaseThe instance is released and its resources are freed.Longer: a new instance must be created.No charges continue.
StopThe instance enters economical mode (stopped) and can be restarted when capacity is available.Shorter: restarting is faster than creating a new instance.No compute charges. Storage charges continue.

Configure in the ECS console

Example 1: Machine learning cluster (cost-optimized)

Scenario: Complete a week-long machine learning task analyzing risk factors in mortgage loans. The cluster needs GPU instances, costs should be minimized, and all instances should be released when the task completes.

Requirements:

  • Region: China (Hangzhou)

  • GPU: NVIDIA V100, up to 32 GB GPU memory per instance

  • Target capacity: 20 instances

  • To minimize costs, create only spot instances. The number of instances in the instance cluster can be less than the target capacity.

  • Instances must be released after the task is completed

Configuration:

SectionParameterSetting
Capacity ConfigurationTarget CapacitySelect Instances from the drop-down list. Set the value to 20.
Instance ConfigurationInstance Configuration1. Select the ecs.gn6v-c8g1.2xlarge and ecs.gn6e-c12g1.3xlarge instance types. These are equipped with NVIDIA V100 GPUs and have up to 32 GB GPU memory. 2. Check instance type availability in Hangzhou Zone H and Hangzhou Zone I on the ECS Instance Types Available for Each Region page. 3. Add two instance configurations: one with a vSwitch in Hangzhou Zone H, and another with a vSwitch in Hangzhou Zone I. Add both instance types to each configuration.
Provisioning PolicySelect Cost Optimization Policy. The group creates instances from the cheapest available resource pool.
Spot Instance Interruption SettingsSelect Release. The number of instances in the instance cluster can be less than the target capacity to minimize costs.
AdvancedGroup TypeSelect One-time Delivery. The number of instances in the instance cluster can be less than the target capacity to minimize costs.
Start Time and End TimeSet the start and end times to cover the one-week task period.
Global Maximum Price for Spot InstancesSelect Set Maximum Price and specify a maximum price that you can afford.
Instance Shutdown SettingsSelect Shut Down Instances Upon Group Expiration to release all instances when the task completes. Select Shut Down Excessive Instances When Target Capacity Is Exceeded to minimize costs.

This configuration forms four resource pools:

Resource poolInstance typeZone
1ecs.gn6v-c8g1.2xlargeHangzhou Zone H
2ecs.gn6e-c12g1.3xlargeHangzhou Zone H
3ecs.gn6v-c8g1.2xlargeHangzhou Zone I
4ecs.gn6e-c12g1.3xlargeHangzhou Zone I

The group evaluates all four pools and creates instances from the cheapest available pool.

For details about these instance types, see Overview of instance families.

Example 2: Ticketing website (high availability)

Scenario: Build a ticketing website that provides reliable service at all hours, including peak traffic. The cluster must sustain a minimum capacity using pay-as-you-go instances and span multiple zones for disaster recovery.

Requirements:

  • Region: China (Hangzhou)

  • Instance type: up to 8 vCPUs per instance (c6 family, suitable for frontend web servers)

  • Target capacity: 80 vCPUs

  • Minimum capacity: 60 vCPUs (guaranteed by pay-as-you-go instances)

  • Disaster recovery across multiple zones

Configuration:

SectionParameterSetting
Capacity ConfigurationTarget CapacitySelect vCPUs from the drop-down list. Set the value to 80. Select Use Pay-as-you-go Instances to Provide Computing Power.
Pay-as-you-go Instance CapacitySet to 60 to guarantee the minimum capacity.
Instance ConfigurationInstance Configuration1. Select the ecs.c6.large, ecs.c6.xlarge, and ecs.c6.2xlarge instance types. 2. Check availability in Hangzhou Zone H, Hangzhou Zone I, and Hangzhou Zone J. 3. Add three instance configurations, one per zone, each with all three instance types.
Provisioning PolicySelect Balanced Distribution Policy. The group evenly creates instances across zones to prevent instance creation failures caused by insufficient resources within a single zone, improving disaster recovery.
Spot Instance Interruption SettingsSelect Stop to ensure that the website can be accessed at a low latency. The time required to recover an instance from stopping in economical mode is less than the time required to create an instance.
AdvancedGroup TypeSelect Continuous Delivery and Maintain Capacity to continuously provide ticketing service.
Start Time and End TimeThe auto provisioning group immediately starts and can be indefinitely retained to continuously provide ticketing service.
Global Maximum Price for Spot InstancesSelect Automatic Bidding to maintain a stable number of instances in the cluster.
Instance Shutdown SettingsSelect Shut Down Excessive Instances When Target Capacity Is Exceeded to minimize costs.

This configuration forms nine resource pools (3 instance types x 3 zones):

Resource poolInstance typeZone
1ecs.c6.largeHangzhou Zone H
2ecs.c6.xlargeHangzhou Zone H
3ecs.c6.2xlargeHangzhou Zone H
4ecs.c6.largeHangzhou Zone I
5ecs.c6.xlargeHangzhou Zone I
6ecs.c6.2xlargeHangzhou Zone I
7ecs.c6.largeHangzhou Zone J
8ecs.c6.xlargeHangzhou Zone J
9ecs.c6.2xlargeHangzhou Zone J

How the balanced distribution policy works

When target capacity is measured in vCPUs, each instance type has a weight equal to its vCPU count.

Instance typevCPUsPay-as-you-go price (USD)WeightWeighted price (USD)
ecs.c6.large20.06 per hour20.03 per hour
ecs.c6.xlarge40.121 per hour40.03025 per hour
ecs.c6.2xlarge80.241 per hour80.030125 per hour
Prices are for reference only. Actual prices on the buy page prevail.

The group follows this allocation sequence:

  1. Distribute across zones: Create instances evenly in Hangzhou Zone H, Zone I, and Zone J.

  2. Select by weighted price: Within each zone, prefer instance types with lower weighted prices.

  3. Random tiebreak: If weighted prices are equal, select an instance type at random.

Configure by calling an API operation

Use the CreateAutoProvisioningGroup API operation to create auto provisioning groups programmatically.

Example 1: Distribute across lowest-price pools

If you want to minimize costs and alleviate the impact of spot instance reclamation caused by using a single resource pool, you can configure an auto provisioning group to use multiple resource pools that have the lowest prices to create instances.

Goal:

  • Create 30 spot instances from a launch template with five resource pools

  • Use the three cheapest pools, creating 10 instances from each

API parameters:

ParameterValueDescription
TotalTargetCapacity30Total target: 30 instances
SpotTargetCapacity30All 30 are spot instances
PayAsYouGoTargetCapacity0No pay-as-you-go instances
SpotAllocationStrategylowest-priceSelect pools by price, lowest first
SpotInstancePoolsToUseCount3Use the 3 cheapest pools out of the 5 available
PayAsYouGoAllocationStrategylowest-priceCost optimization for pay-as-you-go (not used in this example because the count is 0)
LaunchTemplateIdlt-bp1ivgo4p5now3px****The launch template that defines base instance settings

Resource pool configurations (LaunchTemplateConfig):

PoolParameter prefixvSwitch IDInstance typeWeighted capacity
1LaunchTemplateConfig.1vsw-bp1ygryo03m39xhsy****ecs.c6e.large1
2LaunchTemplateConfig.2vsw-bp16hgf8f3kvtcbyu****ecs.c6e.xlarge1
3LaunchTemplateConfig.3vsw-bp1oeawdo9tj2gvjp****ecs.c6e.2xlarge1
4LaunchTemplateConfig.4vsw-bp1oeawdo9tj2gvjp****ecs.g6e.xlarge1
5LaunchTemplateConfig.5vsw-bp1oeawdo9tj2gvjp****ecs.g6e.2xlarge1

Result: The group ranks all five pools by current spot price and creates instances from the three cheapest pools, distributing 10 instances to each.

Example 2: Prioritize a specific resource pool

You can configure an auto provisioning group to create instances by preferentially using a specific resource pool. For example, if you use reserved instances that can be applied to ecs.c6e.large instances, you can configure an auto provisioning group to preferentially select the ecs.c6e.large instance type to benefit from the billing discounts provided by the reserved instances.

Goal:

  • Create 20 instances: 10 spot and 10 pay-as-you-go

  • Create pay-as-you-go instances from the ecs.c6e.large pool first (priority 0 = highest)

API parameters:

ParameterValueDescription
TotalTargetCapacity20Total target: 20 instances
SpotTargetCapacity1010 spot instances
PayAsYouGoTargetCapacity1010 pay-as-you-go instances
SpotAllocationStrategylowest-priceSelect spot pools by price
PayAsYouGoAllocationStrategyprioritizedCreate pay-as-you-go instances by pool priority
LaunchTemplateIdlt-bp1ivgo4p5now3px****The launch template

Resource pool configurations (LaunchTemplateConfig):

PoolParameter prefixvSwitch IDInstance typeWeighted capacityPriority
1LaunchTemplateConfig.1vsw-bp1ygryo03m39xhsy****ecs.c6e.large10 (highest)
2LaunchTemplateConfig.2vsw-bp16hgf8f3kvtcbyu****ecs.c6e.xlarge1--
3LaunchTemplateConfig.3vsw-bp1oeawdo9tj2gvjp****ecs.c6e.2xlarge1--
4LaunchTemplateConfig.4vsw-bp1oeawdo9tj2gvjp****ecs.g6e.xlarge1--
5LaunchTemplateConfig.5vsw-bp1oeawdo9tj2gvjp****ecs.g6e.2xlarge1--

Result: The group creates 10 pay-as-you-go instances from the ecs.c6e.large pool (priority 0). If that pool has insufficient capacity, it falls back to pools 2-5. Spot instances are created from the cheapest available pool.

A priority value of 0 indicates the highest priority. Only set priority on pools used with the prioritized allocation strategy.

References