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

Description

Auto Provisioning is a service to quickly deploy an instance cluster that consists of preemptible and pay-as-you-go instances. Auto Provisioning supports one-click deployment of instance clusters with specified billing methods, zones, and instance families.

Auto Provisioning uses auto provisioning groups to schedule and maintain computing resources. You can use auto provisioning groups to provide stable computing power. This alleviates the instability problem caused by reclaiming preemptible instances.

Auto Provisioning is free to use. However, you are charged for instance resources created through auto provisioning groups. For more information about billing, see Preemptible instance and Pay-as-you-go.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateAutoProvisioningGroup

The operation that you want to perform. Set the value to CreateAutoProvisioningGroup.

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.

RegionId String Yes cn-hangzhou

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

TotalTargetCapacity String Yes 60

The total target capacity of the auto provisioning group. The value must be a positive integer.

The total target capacity of the auto provisioning group must be at least the sum of the target capacity of pay-as-you-go instances specified by the PayAsYouGoTargetCapacity parameter and target capacity of preemptible instances specified by the SpotTargetCapacity parameter.

ResourceGroupId String No rg-bp67acfmxazb4ph***

The ID of the resource group to which to add the auto provisioning group.

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 and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).

AutoProvisioningGroupType String No maintain

The delivery type of the auto provisioning group. Valid values:

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

Default value: maintain

SpotAllocationStrategy String No diversified

The policy for creating preemptible instances. Valid values:

  • lowest-price: cost optimization policy. Auto Provisioning attempts to create instances based on the prices of instance types in ascending order.
  • diversified: balanced distribution policy. Auto Provisioning attempts to create instances in zones that are specified by extended configurations and then distribute the instances across the zones.

Default value: lowest-price

SpotInstanceInterruptionBehavior String No terminate

The next action to take after the excess preemptible instances are stopped. Valid values:

  • stop: maintains the instances in the stopped state.
  • terminate: releases the instances.

Default value: stop

SpotInstancePoolsToUseCount Integer No 2

The number of preemptible instances that Auto Provisioning attempts to create based on the prices of instance types in ascending order. This parameter takes effect when the SpotAllocationStrategy parameter is set to lowest-price.

The parameter value must be less than N specified in the LaunchTemplateConfig.N parameter.

PayAsYouGoAllocationStrategy String No prioritized

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

  • lowest-price: cost optimization policy. Auto Provisioning attempts to create instances based on the prices of instance types in ascending order.
  • prioritized: priority policy. Auto Provisioning attempts to create instances based on the priority specified by the LaunchTemplateConfig.N.Priority parameter.

Default value: lowest-price

ExcessCapacityTerminationPolicy String No termination

Specifies whether to stop excess preemptible instances when the target total capacity of the specified auto provisioning group is reached. Valid values:

  • no-termination: continues to run excess preemptible instances.
  • termination: stops excess preemptible instances. The action to be performed on these stopped instances is specified by the SpotInstanceInterruptionBehavior parameter.

Default value: no-termination

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.

Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

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.

Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

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

TerminateInstancesWithExpiration Boolean No true

Specifies whether to stop preemptible instances when the auto provisioning group expires. Valid values:

  • true: stops preemptible instances. The action to be performed on these stopped instances is specified by the SpotInstanceInterruptionBehavior parameter.
  • false: continues to run preemptible instances.

Default value: false

TerminateInstances Boolean No true

Specifies whether to release instances in the auto provisioning group when the auto provisioning group is deleted.

Default value: false

MaxSpotPrice Float No 2

The maximum price of preemptible instances in the auto provisioning group.

Note When the MaxSpotPrice and LaunchTemplateConfig.N.MaxPrice parameters are both specified, the maximum price is the lower value of the two parameters.
PayAsYouGoTargetCapacity String No 30

The target capacity of pay-as-you-go instances in the auto provisioning group. Valid values: less than the value of TotalTargetCapacity.

SpotTargetCapacity String No 20

The target capacity of preemptible instances in the auto provisioning group. Valid values: less than the value of TotalTargetCapacity.

DefaultTargetCapacityType String No Spot

Specifies the billing method of the capacity difference when the sum of the values of PayAsYouGoTargetCapacity and SpotTargetCapacity is less than the value of TotalTargetCapacity. Valid values:

  • PayAsYouGo: pay-as-you-go instances
  • Spot: preemptible instances

Default value: Spot

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.

Default value: the default version of the instance launch template

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

The instance type of extended configuration N. Valid values of N: 1 to 20. For more information about valid values, see Instance families.

LaunchTemplateConfig.N.MaxPrice Double No 3

The maximum price of preemptible instances in extended configuration N.

Note If you set the LaunchTemplateConfig parameter, you must also set the LaunchTemplateConfig.N.MaxPrice parameter.
LaunchTemplateConfig.N.VSwitchId String No vsw-sn5bsitu4lfzgc5o7****

The ID of the VSwitch in extended configuration N. The zone of the ECS instances created from the extended configurations is determined by the VSwitch.

Note If you set the LaunchTemplateConfig parameter, you must also set the LaunchTemplateConfig.N.VSwitchId parameter.
LaunchTemplateConfig.N.WeightedCapacity Double No 2

The weight of the instance type specified in extended configuration N. A greater weight indicates that a single instance has more computing power, and as a result fewer instances are required. The value of this parameter must be greater than 0.

The weight is calculated based on the computing power of the specified instance type and the minimum computing power of a single node of the cluster. For example, if the minimum computing power of a single node is 8 vCPUs and 60 GiB:

  • The weight of the instance type with 8 vCPUs and 60 GiB can be set to 1.
  • The weight of the instance type with 16 vCPUs and 120 GiB can be set to 2.
LaunchTemplateConfig.N.Priority Integer No 1

The priority of extended configuration N. A value of 0 indicates the highest priority. Valid values: 0 to ∞.

Description String No test

The description of the auto provisioning group.

Response parameters

Parameter Type Example Description
RequestId String 745CEC9F-0DD7-4451-9FE7-8B752F39****

The ID of the request.

AutoProvisioningGroupId String apg-sn54avj8htgvtyh8****

The ID of the auto provisioning group.

Examples

Sample requests

http(s)://ecs.aliyuncs.com/? Action=CreateAutoProvisioningGroup
&LaunchTemplateId=lt-bp1fgzds4bdogu03****
&RegionId=cn-hangzhou
&TotalTargetCapacity=60
&SpotInstancePoolsToUseCount=2
&ExcessCapacityTerminationPolicy=termination
&TerminateInstancesWithExpiration=true
&TerminateInstances=false
&PayAsYouGoTargetCapacity=30
&SpotTargetCapacity=20
&DefaultTargetCapacityType=Spot
&LaunchTemplateConfig.1.InstanceType=ecs.g5.large
&LaunchTemplateConfig.1.MaxPrice=3
&LaunchTemplateConfig.1.VSwitchId=vsw-sn5bsitu4lfzgc5o7****
&LaunchTemplateConfig.1.WeightedCapacity=2
&LaunchTemplateConfig.1.Priority=1
&<Common request parameters>

Sample success responses

XML format

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

JSON format

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

Error codes

HTTP status code Error code Error message Description
400 InvalidFleetExcessCapacityTerminationPolicy.ValueNotSupported The specified parameter "ExcessCapacityTerminationPolicy" is not supported. The error message returned because the specified ExcessCapacityTerminationPolicy parameter is invalid.
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.

For a list of error codes, visit the API Error Center.