All Products
Search
Document Center

Elastic Compute Service:DeleteLaunchTemplateVersion

Last Updated:Sep 29, 2024

Deletes versions of a launch template. When you call this operation, you can specify parameters, such as LaunchTemplateId and DeleteVersion, in the request.

Operation description

Take note of the following items:

  • You cannot delete the default version of a launch template by calling this operation. To delete the default version of a launch template, you must delete the launch template.
  • If the version of a launch template that you want to delete is the default version, call the ModifyLaunchTemplateDefaultVersion operation or go to the Launch Templates page in the Elastic Compute Service (ECS) console to change the default version to a different version, and then delete the original default version.
  • After you delete a version of a launch template, the ECS instances that were created based on the version are not affected.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ecs:DeleteLaunchTemplateVersiondelete
  • LaunchTemplate
    acs:ecs:{#regionId}:{#accountId}:launchtemplate/{#launchtemplateId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

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

cn-hangzhou
DeleteVersionarrayYes

The version numbers of the launch template.

longYes

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

2
LaunchTemplateIdstringNo

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

lt-bp1apo0bbbkuy0rj****
LaunchTemplateNamestringNo

The name of the launch template.

testLaunchTemplateName

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
LaunchTemplateVersionsarray<object>

The deleted launch template versions.

LaunchTemplateVersionobject
LaunchTemplateIdstring

The ID of the launch template.

lt-m5eiaupmvm2op9d****
LaunchTemplateVersionNumberlong

The version number of the launch template.

2

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400InvalidRegion.NotExist%sThe specified region does not exist.
400MissingParameter%sA parameter is not specified.
400InvalidParameter%sThe specified parameter is invalid.
403InvalidOperation.DeleteDefaultVersion%sThe operation is invalid. The default version cannot be deleted.
403InnerServiceFailed%sAn internal service cannot be called.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-03-10The Error code has changed. The response structure of the API has changedView Change Details