tencent cloud

Feedback

ModifyLaunchConfigurationAttributes

Last updated: 2024-10-25 15:16:27

    1. API Description

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

    This API (ModifyLaunchConfigurationAttributes) is used to modify some attributes of a launch configuration.

    • The changes of launch configuration do not affect the existing instances. New instances will be created based on the modified configuration.
    • This API supports modifying certain simple types of attributes.

    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: ModifyLaunchConfigurationAttributes.
    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.
    LaunchConfigurationId Yes String Launch configuration ID
    ImageId No String Image ID in the format of img-xxx. There are three types of images:
  • Public images
  • Custom images
  • Shared images

  • You can obtain the image IDs in the CVM console.
  • You can also use the DescribeImages and look for ImageId in the response.
  • InstanceTypes.N No Array of String List of instance types. Each type specifies different resource specifications. This list contains up to 10 instance types.
    The launch configuration uses InstanceType to indicate one single instance type and InstanceTypes to indicate multiple instance types. Specifying the InstanceTypes field will invalidate the original InstanceType.
    InstanceTypesCheckPolicy No String InstanceType verification policy, which is effective when actual modification is made to InstanceTypes. Valid values include ALL and ANY and the default value is ANY.
  • 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 reasons for unavailable InstanceTypes include the InstanceType being sold out, and the corresponding cloud disk being sold out.
    If a model in InstanceTypes does not exist or has been abolished, a verification error will be reported regardless of the valid values set for InstanceTypesCheckPolicy.
    LaunchConfigurationName No String Display name of the launch configuration, which can contain Chinese characters, letters, numbers, underscores, separators ("-"), and decimal points with a maximum length of 60 bytes.
    UserData No String Base64-encoded custom data of up to 16 KB. If you want to clear UserData, set it to an empty string.
    SecurityGroupIds.N No Array of String Security group to which the instance belongs. This parameter can be obtained from the SecurityGroupId field in the response of the DescribeSecurityGroups API.
    At least one security group is required for this parameter. The security group specified is sequential.
    InternetAccessible No InternetAccessible Information of the public network bandwidth configuration.
    When the public outbound network bandwidth is 0 Mbps, assigning a public IP is not allowed. Accordingly, if a public IP is assigned, the new public network outbound bandwidth must be greater than 0 Mbps.
    InstanceChargeType No String Instance billing mode. Valid values:

  • POSTPAID_BY_HOUR: pay-as-you-go hourly

  • SPOTPAID: spot instance
  • InstanceChargePrepaid No InstanceChargePrepaid Parameter setting for the prepaid mode (monthly subscription mode). This parameter can specify the renewal period, whether to set the auto-renewal, and other attributes of the monthly-subscribed instances.
    This parameter is required when changing the instance billing mode to monthly subscription. It will be automatically discarded after you choose another billing mode.
    This field requires passing in the Period field. Other fields that are not passed in will use their default values.
    This field can be modified only when the current billing mode is monthly subscription.
    InstanceMarketOptions No InstanceMarketOptionsRequest Market-related options for instances, such as parameters related to spot instances.
    This parameter is required when changing the instance billing mode to spot instance. It will be automatically discarded after you choose another instance billing mode.
    This field requires passing in the MaxPrice field under the SpotOptions. Other fields that are not passed in will use their default values.
    This field can be modified only when the current billing mode is spot instance.
    DiskTypePolicy No String Cloud disk type selection policy. Valid values:
  • ORIGINAL: Use the set cloud disk type.
  • AUTOMATIC: Automatically select the currently available cloud disk type.
  • SystemDisk No SystemDisk Instance system disk configurations
    DataDisks.N No Array of DataDisk Configuration information of instance data disks.
    Up to 11 data disks can be specified and will be collectively modified. Please provide all the new values for the modification.
    The default data disk should be the same as the system disk.
    HostNameSettings No HostNameSettings CVM hostname settings.
    This field is not supported for Windows instances.
    This field requires passing the HostName field. Other fields that are not passed in will use their default values.
    InstanceNameSettings No InstanceNameSettings Settings of CVM instance names.
    If this field is configured in a launch configuration, the InstanceName of a CVM created by the scaling group will be generated according to the configuration; otherwise, it will be in the as-{{AutoScalingGroupName }} format.
    This field requires passing in the InstanceName field. Other fields that are not passed in will use their default values.
    EnhancedService No EnhancedService Specifies whether to enable additional services, such as security services and monitoring service.
    CamRoleName No String CAM role name. This parameter can be obtained from the roleName field returned by DescribeRoleList API.
    HpcClusterId No String HPC ID

    Note: This field is default to empty
    IPv6InternetAccessible No IPv6InternetAccessible IPv6 public network bandwidth configuration. If the IPv6 address is available in the new instance, public network bandwidth can be allocated to the IPv6 address. This parameter is invalid if Ipv6AddressCount of the scaling group associated with the launch configuration is 0.
    DisasterRecoverGroupIds.N No Array of String Placement group ID. Only one is allowed.
    LoginSettings No LoginSettings Instance login settings, which include passwords, keys, or the original login settings inherited from the image.
    Please note that specifying new login settings will overwrite the existing ones. For instance, if you previously used a password for login and then use this parameter to switch the login settings to a key, the original password will be removed.
    InstanceTags.N No Array of InstanceTag Instance tag list. By specifying this parameter, the instances added through scale-out can be bound to the tag. Up to 10 Tags can be specified.
    This parameter will overwrite the original instance tag list. To add new tags, you need to pass the new tags along with the original tags.
    ImageFamily No String Image family name.

    3. Output Parameters

    Parameter Name Type Description
    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 Clearing UserData

    This example shows you how to specify the launch configuration asc-291kq6ku and modify UserData to a null string.

    Input Example

    POST / HTTP/1.1
    Host: as.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: ModifyLaunchConfigurationAttributes
    <Common request parameters>
    
    {
        "LaunchConfigurationId": "asc-291kq6ku",
        "UserData": ""
    }
    

    Output Example

    {
        "Response": {
            "RequestId": "2c027f22-3a3b-489a-a77a-89c53fc15212"
        }
    }
    

    Example2 Specifying the Launch Configuration to Modify Images, InstanceTypes, and Names

    This example shows you how to specify the launch configuration asc-291kq6ku and modify the image to img-8toqc6s3, the InstanceType to S2.SMALL1, and the launch configuration name to updated_config.

    Input Example

    POST / HTTP/1.1
    Host: as.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: ModifyLaunchConfigurationAttributes
    <Common request parameters>
    
    {
        "ImageId": "img-8toqc6s3",
        "InstanceTypes": [
            "S2.SMALL1"
        ],
        "LaunchConfigurationName": "updated_config",
        "LaunchConfigurationId": "asc-291kq6ku"
    }
    

    Output Example

    {
        "Response": {
            "RequestId": "07022dcb-5bba-48f0-a2b0-800ad006d031"
        }
    }
    

    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.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.InScenario The parameter is invalid in a specific scenario.
    InvalidParameter.InvalidCombination Invalid parameter combination.
    InvalidParameter.ParameterDeprecated This parameter has been disused.
    InvalidParameter.ParameterMustBeDeleted Some parameters cannot coexist and should be deleted.
    InvalidParameterValue Wrong parameter value.
    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.InvalidLaunchConfigurationId Invalid launch configuration ID.
    InvalidParameterValue.InvalidSecurityGroupId Invalid security group ID.
    InvalidParameterValue.LaunchConfigurationNameDuplicated The launch configuration name already exists.
    InvalidParameterValue.LimitExceeded The value exceeds the limit.
    InvalidParameterValue.MissingBandwidthPackageId The bandwidth package ID is required.
    InvalidParameterValue.NotStringTypeFloat The value should be a floating point string.
    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.
    MissingParameter Parameter missing.
    MissingParameter.InScenario A parameter is missing in a specific scenario.
    ResourceNotFound.BandwidthPackageIdNotFound The specified bandwidth package ID is not found.
    ResourceNotFound.DisasterRecoverGroupNotFound The specified placement group ID does not exist.
    ResourceNotFound.LaunchConfigurationIdNotFound The specified launch configuration does not exist.