Deletes the versions of a launch template. This operation cannot delete the default version of a launch template. To delete the default version, you must call the DeleteLaunchTemplate operation to delete the launch template and all of its versions.

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

ParameterTypeRequiredExampleDescription
ActionStringYesDeleteLaunchTemplateVersion

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

RegionIdStringYescn-hangzhou

The region ID of the launch template. You can call the DescribeRegions operation to query the most recent region list.

DeleteVersion.NLongNo2

The version number of the launch template. Valid values of N: 1 to 29. You can call the DescribeLaunchTemplateVersions operation to query all versions of a launch template.

LaunchTemplateIdStringNolt-bp1apo0bbbkuy0rj****

The ID of the launch template. For more information, see DescribeLaunchTemplates.

LaunchTemplateNameStringNotestLaunchTemplateName

The name of the launch template.

Response parameters

ParameterTypeExampleDescription
RequestIdString473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

LaunchTemplateVersionsArray of LaunchTemplateVersion

The deleted launch template versions.

LaunchTemplateVersion
LaunchTemplateIdStringlt-bp1apo0bbbkuy0rj****

The ID of the launch template.

LaunchTemplateVersionNumberLong2

The version number of the launch template.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=DeleteLaunchTemplateVersion
&DeleteVersion.1=2
&RegionId=cn-hangzhou
&LaunchTemplateId=lt-bp1apo0bbbkuy0rj****
&LaunchTemplateName=testLaunchTemplateName
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DeleteLaunchTemplateVersionResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
    <LaunchTemplateVersions>
        <LaunchTemplateId>lt-bp1apo0bbbkuy0rj****</LaunchTemplateId>
        <LaunchTemplateVersionNumber>2</LaunchTemplateVersionNumber>
    </LaunchTemplateVersions>
</DeleteLaunchTemplateVersionResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
  "LaunchTemplateVersions" : [ {
    "LaunchTemplateId" : "lt-bp1apo0bbbkuy0rj****",
    "LaunchTemplateVersionNumber" : 2
  } ]
}

Error codes

HttpCodeError codeError messageDescription
400InvalidRegion.NotExist%sThee specified region is not found.
400MissingParameter%sA required parameter is not specified.
400InvalidParameter%sInvalid parameter.
403InvalidOperation.DeleteDefaultVersion%sThe specified operation is invalid.
403InnerServiceFailed%sAn internal service cannot be called.

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