You can call this operation to change the default version of an instance launch template. If you do not specify a template version number when you create an instance (RunInstances), the default version is used.

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

Parameter Type Required Example Description
Action String Yes ModifyLaunchTemplateDefaultVersion

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

DefaultVersionNumber Long Yes 2

The default version number of the instance launch template.

RegionId String Yes cn-hangzhou

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

LaunchTemplateId String No lt-s-bp177juajht6****

The ID of the launch template. You must specify the LaunchTemplateId or LaunchTemplateName parameter to determine an instance launch template.

LaunchTemplateName String No testLaunchTemplateName

The name of the instance launch template. You must specify the LaunchTemplateId or LaunchTemplateName parameter to determine an instance launch template.

Response parameters

Parameter Type Example Description
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=ModifyLaunchTemplateDefaultVersion
&DefaultVersionNumber=2
&RegionId=cn-hangzhou
&LaunchTemplateId=lt-s-bp177juajht6****
&LaunchTemplateName=testLaunchTemplateName
&<Common request parameters>

Sample success responses

XML format

<ModifyLaunchTemplateDefaultVersionResponse>
      <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</ModifyLaunchTemplateDefaultVersionResponse>

JSON format

{
    "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

HTTP status code Error code Error message Description
400 InvalidRegion.NotExist %s The error message returned because the specified RegionId parameter does not exist. Check whether the region ID is correct.
404 InvalidLaunchTemplate.NotFound %s The error message returned because the specified launch template does not exist. Check whether the specified LaunchTemplateId or LaunchTemplateName parameter is correct.
404 InvalidLaunchTemplateVersion.NotFound %s The error message returned because the specified LaunchTemplateVersion parameter does not exist. Check whether the launch template version is correct.
400 MissingParameter %s The error message returned because a required parameter is not specified.
400 InvalidParameter %s The error message returned because the specified parameter is invalid.
403 InnerServiceFailed %s The error message returned because an internal service failed to be called.

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