Last updated: 2022-01-18 11:13:34

1. API Description

Domain name for API request:

This API is used to create launch configurations and scaling groups based on an instance.

Note: for a scaling group that is created based on a monthly-subscribed instance, the instances added for scale-out are pay-as-you-go instance.

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

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

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.
This document describes the parameters for Signature V1. It's recommended to use the V3 signature, which provides higher security. Note that for Signature V3, the common parameters need to be placed in the HTTP Header. See details.

Parameter Name Required Type Description
Action Yes String Common parameter. The value used for this API: CreateAutoScalingGroupFromInstance.
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 The scaling group name. It must be unique under your account. The name can only contain letters, numbers, underscore, hyphen “-” and periods. It cannot exceed 55 bytes.
InstanceId Yes String The instance ID.
MinSize Yes Integer The minimum number of instances. Value range: 0-2000.
MaxSize Yes Integer The maximum number of instances. Value range: 0-2000.
DesiredCapacity No Integer The desired capacity. Its value must be greater than the minimum and smaller than the maximum.
InheritInstanceTag No Boolean Whether to inherit the instance tag. Default value: False

3. Output Parameters

Parameter Name Type Description
AutoScalingGroupId String The 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 Creating launch configuration and scaling group based on an instance

Input Example

Content-Type: application/json
X-TC-Action: CreateAutoScalingGroupFromInstance
<Common request parameters>

    "DesiredCapacity": 0,
    "InstanceId": "ins-19a14o9y",
    "AutoScalingGroupName": "as-test",
    "MinSize": 0,
    "MaxSize": 1,
    "InheritInstanceTag": false

Output Example

  "Response": {
    "AutoScalingGroupId": "asg-cqatht5b",
    "RequestId": "19c10733-d0e8-4f58-ac82-e1b1affb0bbb"

5. Developer Resources


TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

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
AccountQualificationRestrictions The requesting account failed to pass the qualification review.
CallCvmError CVM API call failed.
InternalError An internal error occurred.
InternalError.CallVpcError VPC API call failed.
InvalidParameter.InScenario The parameter is invalid in a specific scenario.
InvalidParameterValue.CvmError Exception with CVM parameter validation.
InvalidParameterValue.DuplicatedSubnet Duplicated subnet.
InvalidParameterValue.ForwardLb A CLB should be specified.
InvalidParameterValue.InvalidInstanceId Invalid instance ID.
InvalidParameterValue.LaunchConfigurationNameDuplicated The launch configuration name already exists.
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.TooLong Too many values.
LimitExceeded.AutoScalingGroupLimitExceeded The number of auto scaling groups exceeds the limit.
LimitExceeded.DesiredCapacityLimitExceeded The desired number of instances 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 Parameter missing.
ResourceNotFound.InstancesNotFound The specified instance does not exist.
ResourceUnavailable.LaunchConfigurationStatusAbnormal The launch configuration is exceptional.
ResourceUnavailable.ProjectInconsistent Project inconsistency.
ResourceUnavailable.StoppedInstanceNotAllowAttach Unable to add instances to the scaling group when they are shut down.