tencent cloud

APIs

CreateLaunchConfiguration

Baixar
Modo Foco
Tamanho da Fonte
Última atualização: 2026-09-10 11:57:22

1. API Description

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

This API is used to create a new launch configuration.

  • Launch configuration can be partially modified through ModifyLaunchConfigurationAttributes. If a new launch configuration is needed, it is advisable to create a new one.

  • A maximum of 50 launch configurations can be created per region by default. For details, see usage limits (https://www.tencentcloud.com/document/product/377/3120?from_cn_redirect=1).

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.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: CreateLaunchConfiguration.
Version Yes String Common Params. The value used for this API: 2018-04-19.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
LaunchConfigurationName Yes String

Display name of the launch configuration. The name only supports Chinese, English, numbers, underscores, the separator "-", and decimal points. The maximum length cannot exceed 60 bytes.

ImageId No String

Specify a valid image ID, such as img-8toqc6s3. One and only one of image ID and image family name must be filled in. There are four image types:

  • Public image
  • Custom image
  • Shared image
  • Service market image

  • You can get available image IDs in the following ways:
  • You can query the image IDs of public images, custom images, and shared images by logging in to the console; query the image IDs in the service image market in Marketplace.
  • Call the DescribeImages API and get the ImageId field in the returned information.
  • ProjectId No Integer

    The project ID of the launch configuration. Default value: 0, indicating the default project. Obtain this parameter by calling DescribeProject and using the projectId field in the return value.
    Note: The project ID of instances within the scaling group is the scaling group project ID, irrelevant to the value here.

    InstanceType No String

    Instance model. Different instance models specify different resource specifications. The specific values can be obtained by calling the DescribeZoneInstanceConfigInfos API to get the latest specification table or refer to the instance type description.
    The InstanceType and InstanceTypes parameters are mutually exclusive, and one and only one must be filled in.

    SystemDisk No SystemDisk

    Instance system disk configuration information. If not specified, it will be allocated based on system default values.

    DataDisks.N No Array of DataDisk

    Instance data disk configuration information. If not specified, no data disks are purchased by default, and a maximum of 11 data disks can be specified.

    InternetAccessible No InternetAccessible

    Public network bandwidth-related information settings. If not specified, the public network bandwidth defaults to 0 Mbps.

    LoginSettings No LoginSettings

    Instance login settings. Through this parameter, you can set the instance's login method to password, key, or maintain the image's original login settings. By default, a password will be randomly generated, and the user will be notified through an internal message.

    SecurityGroupIds.N No Array of String

    Security group to which an instance belongs. The value of this parameter can be obtained from the returned SecurityGroupId field of the DescribeSecurityGroups API. If this parameter is not specified, no security groups are associated by default.

    EnhancedService No EnhancedService

    Enhancement services. This parameter can be used to specify whether to enable services such as Cloud Monitor and cloud security. If not specified, cloud monitoring and cloud security services are enabled by default.

    UserData No String

    Custom data after Base64 encoding should not exceed 16KB.

    InstanceChargeType No String

    Instance billing type. The default value of CVM is handled as POSTPAID_BY_HOUR.

  • POSTPAID_BY_HOUR: hourly postpaid
  • SPOTPAID: spot payment
  • PREPAID: prepayment, which is monthly subscription
  • CDCPAID: dedicated cluster payment
  • InstanceMarketOptions No InstanceMarketOptionsRequest

    Market options of the instance, such as spot instance parameters. This parameter is required if the payment mode of the specified instance is spot payment.

    InstanceTypes.N No Array of String

    Instance model list. Different instance models specify different resource specifications, and a maximum of 10 instance models are supported.
    The InstanceType and InstanceTypes parameters are mutually exclusive. One and only one of them must be filled in. To obtain the specific values, call the API DescribeZoneInstanceConfigInfos to get the latest specification table or see Instance Specifications.

    CamRoleName No String

    CAM role name, which can be obtained from the roleName in the return value from the DescribeRoleList API.

    InstanceTypesCheckPolicy No String

    Instance type validation policy. Valid values include ALL and ANY. Default value: ANY. This parameter is valid only when InstanceTypes contains multiple models.

  • ALL: Verification passes if all InstanceTypes are available; otherwise, a verification error will be reported.
  • ANY: Verification passes if any InstanceType is available; otherwise, a verification error will be reported.
  • Common causes of InstanceTypes unavailable include the instance type sold out and the corresponding cloud disk sold out.
    If a model in InstanceTypes does not exist or has been removed, a verification error will be reported regardless of the value of InstanceTypesCheckPolicy.

    InstanceTags.N No Array of InstanceTag

    Tag list. By specifying this parameter, the instances added through scale-out can be bound to the tag. A maximum of 10 tags can be specified.

    Tags.N No Array of Tag

    Tag description list. By specifying this parameter, you can bind tags to a launch configuration. Each launch configuration supports up to 30 tags.

    HostNameSettings No HostNameSettings

    Related settings of the CVM host name (HostName).
    Setting the host name for windows instances is unsupported.
    When adding this attribute, you must pass the CVM host name. Other unspecified fields will be set to default values.
    The host name (with the suffix added if it exists) is verified against a maximum length of 46 characters.

    InstanceNameSettings No InstanceNameSettings

    Related settings of CVM instance name (InstanceName).
    If the user sets this field in the launch configuration, the InstanceName of instances created by the scaling group is set according to this field and transmitted to CVM. If the user does not set this field in the launch configuration, the InstanceName of instances created by the scaling group is set as "as-{{ scaling group AutoScalingGroupName }}" and transmitted to CVM.
    When adding new this attribute, the instance name of the CVM must be transmitted. Other fields not transmitted will be set as default values.
    It will verify whether the instance name (plus the suffix if it exists) exceeds the maximum length of 108 characters.

    InstanceChargePrepaid No InstanceChargePrepaid

    Prepaid mode, that is, parameter settings related to monthly/annual subscription. By specifying this parameter, you can specify the purchase duration of annual and monthly subscription instances, whether to enable auto-renewal, and other attributes. If the billing mode of the specified instance is prepaid, this parameter must be passed.

    DiskTypePolicy No String

    Cloud disk type selection policy. Default value: ORIGINAL. Value range:

  • ORIGINAL: use the set cloud disk type
  • AUTOMATIC: automatically select the currently available cloud disk type
  • HpcClusterId No String

    Hyper Computing Cluster ID. This parameter is currently not supported on the international site.

    IPv6InternetAccessible No IPv6InternetAccessible

    Public network bandwidth-related information settings for IPv6. If the new instance contains an IPv6 address, this parameter can allocate public network bandwidth to the IPv6 address of the new instance. When the Ipv6AddressCount parameter of the scaling group associated with the launch configuration is 0, this parameter will not take effect.

    DisasterRecoverGroupIds.N No Array of String

    Placement Group id. Only one can be specified.

    ImageFamily No String

    Image family name. Either image Id or image family name must be specified, and one and only one must be filled in. This parameter can be obtained through the DescribeImages API.

    DedicatedClusterId No String

    CDC ID. Obtain this parameter through the DescribeDedicatedClusters API.

    Metadata No Metadata

    Custom metadata.

    NetworkInterfaces.N No Array of NetworkInterface

    Configure the elastic network interface for scale-out instances.

    Input limits: up to 17 items. When configuring this parameter, you must explicitly include and can only include one PRIMARY. AS does not auto-complete the primary ENI. An explicitly empty array is illegal. Spot instances do not support this parameter.

    The VPC and subnet are automatically injected by the scaling group based on the current candidate subnets. If not configured, they are not transmitted to CVM. The SecurityGroupIds parameter in the launch configuration is retained.

    3. Output Parameters

    Parameter Name Type Description
    LaunchConfigurationId String

    When creating a launch configuration through this interface, this parameter will be returned, indicating the launch configuration ID.

    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Creating a Launch Configuration While Various Instance Models Are Supported

    This example shows you how to create a launch configuration while instance models S2.SMALL2 and S2.SMALL4 are supported.

    Input Example

    POST / HTTP/1.1
    Host: as.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: CreateLaunchConfiguration
    <Common request parameters>
    
    {
        "ImageId": "img-8toqc6s3",
        "InstanceTypes": [
            "S2.SMALL4",
            "S2.SMALL2"
        ],
        "LaunchConfigurationName": "multi_instance_types"
    }

    Output Example

    {
        "Response": {
            "LaunchConfigurationId": "asc-77mh1cho",
            "RequestId": "2864c860-27a0-439e-a1e1-0003b76734e7"
        }
    }

    Example2 Creating Spot Instance Configurations

    This example shows you how to create a launch configuration with the following parameters: launch configuration name: spot-test; instance model: Standard 2 2C4G (S2.MEDIUM4); billing configuration: spot (SPOTPAID); highest price: 0.99 USD/hour.

    Input Example

    POST / HTTP/1.1
    Host: as.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: CreateLaunchConfiguration
    <Common request parameters>
    
    {
        "SystemDisk": {
            "DiskSize": 50,
            "DiskType": "CLOUD_PREMIUM"
        },
        "InstanceMarketOptions": {
            "SpotOptions": {
                "SpotInstanceType": "one-time",
                "MaxPrice": "0.99"
            },
            "MarketType": "spot"
        },
        "ImageId": "img-8toqc6s3",
        "InstanceChargeType": "SPOTPAID",
        "LaunchConfigurationName": "spot-test",
        "InternetAccessible": {
            "PublicIpAssigned": true,
            "InternetChargeType": "TRAFFIC_POSTPAID_BY_HOUR",
            "InternetMaxBandwidthOut": 20
        },
        "InstanceType": "S2.MEDIUM4"
    }

    Output Example

    {
        "Response": {
            "LaunchConfigurationId": "asc-hpzwe3o2",
            "RequestId": "ccfe3052-e9c9-47ee-bf3d-5bc2dfd972c0"
        }
    }

    Example3 Performing Creation with Simple Parameters

    This example shows you how to create a launch configuration by passing only required parameters, such as the launch configuration name, instance model, and image ID, and using the default value for other parameters. Specific configurations are as follows: launch configuration name: as_test; instance model: Standard 2 1C1G (S2.SMALL1); image ID: img-8toqc6s3.

    Input Example

    POST / HTTP/1.1
    Host: as.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: CreateLaunchConfiguration
    <Common request parameters>
    
    {
        "ImageId": "img-8toqc6s3",
        "InstanceType": "S2.SMALL1",
        "LaunchConfigurationName": "as_test"
    }

    Output Example

    {
        "Response": {
            "LaunchConfigurationId": "asc-23h37kyn",
            "RequestId": "d639dd64-9e46-4246-b13c-80954f81c11b"
        }
    }

    Example4 Performing Creation with Detailed Parameters

    Startup configuration name: as_test, image ID: img-8toqc6s3, select instance type: Standard 2 1C1G (S2.SMALL1), system disk: 50G local hard disk, data disk: 100G basic cloud disk, do not retain data disk when instance is terminated, no encryption for data disk, public network billing: traffic postpaid by hour, public network bandwidth cap: 5 Mbps, public IP allocation, key-based login, installation of cloud monitoring and cloud security.

    Input Example

    POST / HTTP/1.1
    Host: as.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: CreateLaunchConfiguration
    <Common request parameters>
    
    {
        "SystemDisk": {
            "DiskSize": 50,
            "DiskType": "LOCAL_BASIC"
        },
        "LoginSettings": {
            "KeyIds": [
                "skey-k8eypc1l"
            ]
        },
        "ImageId": "img-8toqc6s3",
        "EnhancedService": {
            "SecurityService": {
                "Enabled": true
            },
            "MonitorService": {
                "Enabled": true
            }
        },
        "LaunchConfigurationName": "as_test",
        "InternetAccessible": {
            "PublicIpAssigned": true,
            "InternetChargeType": "TRAFFIC_POSTPAID_BY_HOUR",
            "InternetMaxBandwidthOut": 5
        },
        "InstanceType": "S2.SMALL1",
        "DataDisks": [
            {
                "Encrypt": false,
                "DeleteWithInstance": true,
                "DiskSize": 100,
                "DiskType": "CLOUD_BASIC"
            }
        ]
    }

    Output Example

    {
        "Response": {
            "LaunchConfigurationId": "asc-fdz8j7dh",
            "RequestId": "9a7209d3-2260-49d7-952a-dfa2001f8822"
        }
    }

    5. Developer Resources

    SDK

    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
    InternalError.CallStsError STS API call failure.
    InternalError.CalleeError Exceptions occurred while invoking other services.
    InvalidParameter.ActionNotFound Invalid Action request.
    InvalidParameter.Conflict Multiple parameters specified conflict and cannot co-exist.
    InvalidParameter.HostNameUnavailable The hostname parameter is unavailable to this image.
    InvalidParameter.InvalidCombination Invalid parameter combination.
    InvalidParameter.MustOneParameter Missing parameter. One of the two parameters must be specified.
    InvalidParameter.ParameterDeprecated This parameter has been disused.
    InvalidParameter.ParameterMustBeDeleted Some parameters cannot coexist and should be deleted.
    InvalidParameterCombination.NetworkInterfacesConflict NetworkInterfaces does not support combined use with basic network, IPv6, or spot instance billing mode.
    InvalidParameterValue.AccountNotSupportBandwidthPackageId The bandwidth package ID is not supported in this account.
    InvalidParameterValue.CvmConfigurationError Exception with CVM parameter validation.
    InvalidParameterValue.HostNameIllegal Invalid hostname
    InvalidParameterValue.HostNameWithSuffixTooLong HostNames with suffixes are too long and exceed the specified upper limit.
    InvalidParameterValue.IPv6InternetChargeType The specified IPv6 public network bandwidth billing mode is invalid.
    InvalidParameterValue.ImageNotFound The specified image does not exist.
    InvalidParameterValue.InstanceNameIllegal Invalid instance name
    InvalidParameterValue.InstanceNameWithSuffixTooLong Instance names with suffixes are too long and exceed the specified upper limit.
    InvalidParameterValue.InstanceTypeNotSupported The instance type is not supported.
    InvalidParameterValue.InvalidDisasterRecoverGroupId The format of the placement group ID is incorrect.
    InvalidParameterValue.InvalidHpcClusterId The HPC ID is invalid.
    InvalidParameterValue.InvalidImageId Invalid image ID.
    InvalidParameterValue.InvalidInstanceType Invalid instance type.
    InvalidParameterValue.InvalidLaunchConfiguration Invalid launch configuration input.
    InvalidParameterValue.InvalidSecurityGroupId Invalid security group ID.
    InvalidParameterValue.InvalidSnapshotId Snapshot ID is invalid.
    InvalidParameterValue.LaunchConfigurationNameDuplicated The launch configuration name already exists.
    InvalidParameterValue.LimitExceeded The value exceeds the limit.
    InvalidParameterValue.MissingBandwidthPackageId The bandwidth package ID is required.
    InvalidParameterValue.NetworkInterfacesInvalid Invalid Multi-NIC parameter NetworkInterfaces.
    InvalidParameterValue.NetworkInterfacesLimitExceeded The number of network interface cards in NetworkInterfaces exceeds the upper limit 17.
    InvalidParameterValue.NotStringTypeFloat The value should be a floating point string.
    InvalidParameterValue.ProjectIdNotFound Project ID does not exist.
    InvalidParameterValue.TooLong Too many values.
    InvalidParameterValue.TooShort The value of input parameter is too short.
    InvalidParameterValue.UserDataFormatError Incorrect UserData format.
    InvalidParameterValue.UserDataSizeExceeded The UserData is too long.
    InvalidPermission The account does not support this operation.
    LimitExceeded.LaunchConfigurationQuotaNotEnough Insufficient launch configuration quotas.
    MissingParameter Parameter missing.
    MissingParameter.InstanceMarketOptions The InstanceMarketOptions parameter is required for spot billing type.
    ResourceNotFound.BandwidthPackageIdNotFound The specified bandwidth package ID is not found.
    ResourceNotFound.DisasterRecoverGroupNotFound The specified placement group ID does not exist.
    UnauthorizedOperation.AutoScalingRoleUnauthorized Unauthorized preset service role AS_QCSRole for Auto Scaling. Please visit the Auto Scaling console to authorize.

    Ajuda e Suporte

    Esta página foi útil?

    comentários