CreateAutoScalingGroup

Last updated: 2019-12-11 15:23:59

PDF

1. API Description

Domain name for API request: as.tencentcloudapi.com.

This API (CreateAutoScalingGroup) is used to create an auto scaling group.

A maximum of 20 requests can be initiated per second for this API.

Note: This API supports Finance regions. If the common parameter Region is a Finance region, a domain name with the Finance region needs to be specified, for example: as.ap-shanghai-fsi.tencentcloudapi.com

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common parameter. The value used for this API: CreateAutoScalingGroup
Version Yes String Common parameter. The value used for this API: 2018-04-19
Region Yes String Common parameter. For more information, please see the list of regions supported by the product.
AutoScalingGroupName Yes String Auto scaling group name, which can only contain letters, numbers, underscores, hyphens ("-"), and decimal points with a maximum length of 55 bytes and must be unique under your account.
LaunchConfigurationId Yes String Launch configuration ID
MaxSize Yes Integer Maximum number of instances. Value range: 0-2,000.
MinSize Yes Integer Minimum number of instances. Value range: 0-2,000.
VpcId Yes String VPC ID; if on a basic network, enter an empty string
DefaultCooldown No Integer Default cooldown period in seconds. Default value: 300
DesiredCapacity No Integer Desired number of instances. The number should be no larger than the maximum and no smaller than minimum number of instances
LoadBalancerIds.N No Array of String List of classic CLB IDs. Currently, the maximum length is 20. You cannot specify LoadBalancerIds and ForwardLoadBalancers at the same time.
ProjectId No Integer Project ID
ForwardLoadBalancers.N No Array of ForwardLoadBalancer List of CLBs. Currently, the maximum length is 20. You cannot specify LoadBalancerIds and ForwardLoadBalancers at the same time.
SubnetIds.N No Array of String List of subnet IDs. A subnet must be specified in the VPC scenario. If multiple subnets are entered, their priority will be determined by the order in which they are entered, and they will be tried one by one until instances can be successfully created.
TerminationPolicies.N No Array of String Termination policy. Currently, the maximum length is 1. Value range: OLDEST_INSTANCE, NEWEST_INSTANCE. Default value: OLDEST_INSTANCE.

  • OLDEST_INSTANCE: The oldest instance in the auto scaling group will be terminated first.

  • NEWEST_INSTANCE: The newest instance in the auto scaling group will be terminated first.
  • Zones.N No Array of String List of availability zones. An availability zone must be specified in the basic network scenario. If multiple availability zones are entered, their priority will be determined by the order in which they are entered, and they will be tried one by one until instances can be successfully created.
    RetryPolicy No String Retry policy. Value range: IMMEDIATE_RETRY, INCREMENTAL_INTERVALS, and NO_RETRY. Default value: IMMEDIATE_RETRY.

  • IMMEDIATE_RETRY: Retrying immediately in a short period of time and stopping after a number of consecutive failures (5).

  • INCREMENTAL_INTERVALS: Retrying at incremental intervals, i.e., as the number of consecutive failures increases, the retry interval gradually increases, ranging from one second to one day.

  • NO_RETRY: No retry until a user call or alarm message is received again.
  • ZonesCheckPolicy No String Availability zone verification policy. Value range: ALL, ANY. Default value: ANY.

  • ALL: The verification will succeed only if all availability zones (Zone) or subnets (SubnetId) are available; otherwise, an error will be reported.

  • ANY: The verification will success if any availability zone (Zone) or subnet (SubnetId) is available; otherwise, an error will be reported.

    Common reasons why an availability zone or subnet is unavailable include stock-out of CVM instances or CBS cloud disks in the availability zone, insufficient quota in the availability zone, or insufficient IPs in the subnet.
    If an availability zone or subnet in Zones/SubnetIds does not exist, a verification error will be reported regardless of the value of ZonesCheckPolicy.
  • Tags.N No Array of Tag List of tag descriptions. This parameter is used to bind a tag to an auto scaling group as well as the corresponding resource instances.
    ServiceSettings No ServiceSettings Service settings such as unhealthy instance replacement.
    Ipv6AddressCount No Integer

    3. Output Parameters

    Parameter Name Type Description
    AutoScalingGroupId String Auto scaling group ID
    RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    Example1

    Input Example

    https://as.tencentcloudapi.com/?Action=CreateAutoScalingGroup
    &AutoScalingGroupName=asg-vpc-7layer-lb
    &DefaultCooldown=300
    &DesiredCapacity=0
    &LaunchConfigurationId=asc-7vucy6ae
    &MaxSize=10
    &MinSize=0
    &ProjectId=0
    &VpcId=vpc-hy436tmc
    &SubnetIds.0=subnet-3tmerl37
    &SubnetIds.1=subnet-b0vxjhot
    &TerminationPolicies.0=OLDEST_INSTANCE
    &ForwardLoadBalancers.0.LoadBalancerId=lb-23aejgcv
    &ForwardLoadBalancers.0.ListenerId=lbl-ncw704sn
    &ForwardLoadBalancers.0.LocationId=loc-l3hmaev9
    &ForwardLoadBalancers.0.TargetAttributes.0.Port=8080
    &ForwardLoadBalancers.0.TargetAttributes.0.Weight=10
    &<common request parameters>

    Output Example

    {
      "Response": {
        "AutoScalingGroupId": "asg-nkdwoui0",
        "RequestId": "a5d66fed-85b9-4f43-8243-597337ba896e"
      }
    }

    5. Developer Resources

    API Explorer

    This tool allows online call, signature authentication, SDK code generation and quick search of APIs to greatly improve the efficiency of using TencentCloud APIs.

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    InternalError Internal error.
    InvalidParameter.InScenario The parameter is invalid in a specific scenario.
    InvalidParameterValue.CvmError Exception with CVM parameter validation.
    InvalidParameterValue.ForwardLb An application load balancer is incorrectly specified.
    InvalidParameterValue.GroupNameDuplicated The auto scaling group name already exists.
    InvalidParameterValue.LaunchConfigurationNotFound The specified launch configuration was not found.
    InvalidParameterValue.LbProjectInconsistent The load balancer is in a different project.
    InvalidParameterValue.LbVpcInconsistent The load balancer and the auto scaling group are in different VPCs.
    InvalidParameterValue.LimitExceeded The value exceeds the limit.
    InvalidParameterValue.OnlyVpc The account only supports VPCs.
    InvalidParameterValue.Range The value is outside the specified range.
    InvalidParameterValue.Size The value of maximum, minimum, or desired number of instances in the auto scaling group is invalid.
    InvalidParameterValue.SubnetIds The subnet information is invalid.
    InvalidParameterValue.TooLong Too many values.
    LimitExceeded Quota limit is exceeded.
    LimitExceeded.AutoScalingGroupLimitExceeded The number of auto scaling groups exceeds the limit.
    LimitExceeded.MaxSizeLimitExceeded The maximum number of instances exceeds the limit.
    LimitExceeded.MinSizeLimitExceeded The minimum number of instances is below the limit.
    MissingParameter.InScenario A parameter is missing in a specific scenario.
    ResourceNotFound.LoadBalancerNotFound The specified load balancer was not found.
    ResourceUnavailable.LaunchConfigurationStatusAbnormal The launch configuration is exceptional.
    ResourceUnavailable.ProjectInconsistent Project inconsistency.