You can call this operation to create an auto provisioning group.

Auto Provisioning is free to use. However, instance resources created through auto provisioning will incur charges. For more information on pricing, see Preemptible instance and Pay-as-you-go.

Debugging

Alibaba Cloud provides OpenAPI Explorer to simplify API usage. You can use OpenAPI Explorer to search for APIs, call APIs, and dynamically generate SDK example code.

Request parameters

Parameter Type Required Example Description
LaunchTemplateId String Yes lt-bp1fgzds4bdogu03****

The ID of the instance launch template associated with the auto provisioning group. You can call the DescribeLaunchTemplates operation to query available instance launch templates.

An auto provisioning group can be associated with only one instance launch template. But you can configure multiple extended configurations for the launch template through the LaunchTemplateConfig parameter.

RegionId String Yes cn-hangzhou

The region ID of the auto provisioning group. You can call the DescribeRegions operation to query the latest region list.

TotalTargetCapacity String Yes 60

The total target capacity of the auto provisioning group. The target capacity consists of the following three parts:

  • The target capacity of pay-as-you-go instances specified by the PayAsYouGoTargetCapacity parameter
  • The target capacity of preemptible instances specified by the SpotTargetCapacity parameter
  • The supplemental capacity besides PayAsYouGoTargetCapacity and SpotTargetCapacity
Action String No CreateAutoProvisioningGroup

The operation that you want to perform. Set this parameter to CreateAutoProvisioningGroup.

AutoProvisioningGroupName String No apg-test

The name of the auto provisioning group to be created. It must be 2 to 128 characters in length. It must start with a letter but cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).

AutoProvisioningGroupType String No maintain

The type of the auto provisioning group. Valid values:

  • request: One-time delivery. After the auto provisioning group is started, it only attempts to create an instance cluster once. If the cluster fails to be created, the group does not try again.
  • maintain: The continuous delivery and maintain capacity type. After the auto provisioning group is started, it continuously attempts to create and maintain the instance cluster. The auto provisioning group compares the real-time and target capacity of the cluster. If the cluster does not meet the target capacity, the group will create instances until the cluster meets the target capacity.

Default value: maintain

DefaultTargetCapacityType String No Spot

The type of supplemental instances. When the total value of PayAsYouGoTargetCapacity and SpotTargetCapacity is smaller than the value of TotalTargetCapacity, the auto provisioning group will create instances of the specified type to meet the capacity requirements. Valid values:

  • PayAsYouGo: Pay-as-you-go instances.
  • Spot: Preemptible instances.

Default value: Spot

Description String No test

The description of the auto provisioning group.

ExcessCapacityTerminationPolicy String No termination

The shutdown policy for excess preemptible instances followed when the capacity of the auto provisioning group exceeds the target capacity. Valid values:

  • no-termination: Excess preemptible instances are not shut down.
  • termination: Excess preemptible instances are to be shut down. The action to be performed on these shutdown instances is specified by the SpotInstanceInterruptionBehavior parameter.

Default value: no-termination

LaunchTemplateConfig.N.InstanceType String No ecs.g5.large

The instance type of the Nth extended configurations of the launch template.

LaunchTemplateConfig.N.MaxPrice Double No 3

The maximum price of the instance type specified in the Nth extended configurations of the launch template.

LaunchTemplateConfig.N.Priority Integer No 1

The priority of the instance type specified in the Nth extended configurations of the launch template. A value of 0 indicates the highest priority.

LaunchTemplateConfig.N.VSwitchId String No vsw-sn5bsitu4lfzgc5o7****

The ID of the VSwitch in the Nth extended configurations of the launch template.

LaunchTemplateConfig.N.WeightedCapacity Double No 2

The weight of the instance type specified in the Nth extended configurations of the launch template.

The weight is calculated based on the computing power of a specified instance type and the minimum computing power of a single node of the cluster. A greater weight indicates that the instance has more computing power, and as a result fewer instances are required.

For example, when the minimum computing power of a single node is 8 vCPUs and 60 GiB of memory, the weight of the instance type with 8 vCPUs and 60 GiB of memory is 1, and the weight of the instance type with 16 vCPUs and 120 GiB of memory is 2.

LaunchTemplateVersion String No 1

The version of the instance launch template associated with the auto provisioning group. You can call the DescribeLaunchTemplateVersions operation to query the versions of available instance launch templates.

MaxSpotPrice Float No 2

The global maximum price for preemptible instances in the auto provisioning group. If both the MaxSpotPrice and LaunchTemplateConfig.N.MaxPrice parameters are specified, the maximum price is the lower value of the two.

PayAsYouGoAllocationStrategy String No prioritized

The scale-out policy for pay-as-you-go instances. Valid values:

  • lowest-price: The cost optimization policy the auto provisioning group follows to select instance types of the lowest cost to create instances.
  • prioritized: The priority-based policy the auto provisioning group follows to create instances. The priority of an instance type is specified by the LaunchTemplateConfig.N.Priority parameter.

Default value: lowest-price

PayAsYouGoTargetCapacity String No 30

The target capacity of pay-as-you-go instances in the auto provisioning group.

SpotAllocationStrategy String No diversified

The scale-out policy for preemptible instances. Valid values:

  • lowest-price: The cost optimization policy the auto provisioning group follows to select instance types of the lowest cost to create instances.
  • diversified: The distribution balancing policy the auto provisioning group follows to evenly create instances across zones specified in multiple extended template configurations.

Default value: lowest-price

SpotInstanceInterruptionBehavior String No terminate

The default behavior after preemptible instances are shut down. Value values:

  • stop: stops preemptible instances.
  • terminate: releases preemptible instances.

Default value: stop

SpotInstancePoolsToUseCount Integer No 2

This parameter takes effect when the SpotAllocationStrategy parameter is set to lowest-price. The auto provisioning group selects instance types of the lowest cost to create instances.

SpotTargetCapacity String No 20

The target capacity of preemptible instances in the auto provisioning group.

TerminateInstances Boolean No true

Specifies whether to release instances of the auto provisioning group. Valid values:

  • true
  • false

Default: false

TerminateInstancesWithExpiration Boolean No true

The shutdown policy for preemptible instances when the auto provisioning group expires. Valid values:

  • true: shuts down preemptible instances. The action to be performed on these shutdown instances is specified by the SpotInstanceInterruptionBehavior parameter.
  • false: does not shut down preemptible instances.

Default: false

ValidFrom String No 2019-04-01T15:10:20Z

The time when the auto provisioning group is started. The period of time between this point in time and the point in time specified by the ValidUntil parameter is the effective time period of the auto provisioning group.

By default, an auto provisioning group is immediately started after creation.

ValidUntil String No 2019-06-01T15:10:20Z

The time when the auto provisioning group expires. The period of time between this point in time and the point in time specified by the ValidFrom parameter is the effective time period of the auto provisioning group.

By default, an auto provisioning group never expires.

Response parameters

Parameter Type Example Description
AutoProvisioningGroupId String apg-sn54avj8htgvtyh8****

The ID of the auto provisioning group.

RequestId String 745CEC9F-0DD7-4451-9FE7-8B752F39****

The ID of the request.

Examples

Sample requests


http(s)://ecs.aliyuncs.com/? Action=CreateAutoProvisioningGroup
&LaunchTemplateId=lt-bp1fgzds4bdogu03****
&RegionId=cn-hangzhou
&TotalTargetCapacity=60
&<Common request parameters>

Sample success responses

XML format

<CreateAutoProvisioningGroupResponse>
  <CreateAutoProvisioningGroupId>apg-sn54avj8htgvtyh8****</CreateAutoProvisioningGroupId>
  <RequestId>745CEC9F-0DD7-4451-9FE7-8B752F39****</RequestId>
</CreateAutoProvisioningGroupResponse>

JSON format

{
	"RequestId":"745CEC9F-0DD7-4451-9FE7-8B752F39****",
	"CreateAutoProvisioningGroupId":"apg-sn54avj8htgvtyh8****"
}

Error codes

HTTP status code Error code Error message Description
500 InternalError The request processing has failed due to some unknown error. The error message returned because an internal error has occurred. Try again later. If the problem persists, submit a ticket.

View error codes