For the complete documentation index, see llms.txt. This page is also available as Markdown.

ModifyInstanceType

1. API Description

This API (ModifyInstanceType) is used to changes the instance type of the specified elastic compute instance.

Notes

  • This interface is asynchronous. The request to change the instance type returns immediately after it is sent successfully, but the operation is not completed at that point. The operation result can be queried by calling the DescribeInstancesStatus interface: if the instance status (instanceStatus) changes from RESIZING to STOPPED, the instance type is changed successfully. No operation can be performed on the instance during the change.

  • This operation can be performed only on instances in the STOPPED status.

  • The instanceType of a VM instance is an instance type ID, such as z2a.cpu.4; the instanceType of a GPU instance is a GPU instance type ID, such as z3a.g.C49.c8m32.1; the instanceType of an accelerator instance is an accelerator instance type ID, such as z2a.v.T1U.c16m64.1.

  • Changing the type of an accelerator instance can only adjust the CPU, memory, and number of cards. The accelerator card model cannot be changed through a type change.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

instanceId

Yes

String

ID of the instance to be changed.

It can be obtained by calling DescribeInstances.

instanceType

Yes

String

Target instance type to change to.

The value for a regular instance can be obtained through DescribeZoneInstanceConfigInfos, and the value for a GPU instance can be obtained through DescribeZoneGpuInstanceConfigInfos.

3. Output Parameters

Parameter Name
Type
Description

requestId

String

The unique request ID, which is returned for each request.

RequestId is required for locating a problem.

4. Code Example

1. Modify the type of a VM instance.

2. Modify the type of a GPU instance.

3. Modify the type of an accelerator instance.

5. Developer Resources

Zenlayer Cloud API 2.0 integrates SDKs,to make it easier for you to call APIs. More programming languages will be supported.

6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

HTTP Status Code
Error Code
Description

404

INVALID_INSTANCE_NOT_FOUND

Instance not found.

404

INVALID_INSTANCE_TYPE_NOT_FOUND

Instance type not found.

400

OPERATION_DENIED_INSTANCE_STATUS_NOT_SUPPORT

Current instance state does not allow this operation.

400

OPERATION_FAILED_INSTANCE_TYPE_UNSUPPORTED

The specified instance type is not supported for this instance.

400

OPERATION_DENIED_INSTANCE_TYPE_SAME_AS_CURRENT

The target instance type is the same as the current one. No modification is needed.

400

INVALID_IMAGE_SPEC_NOT_SUPPORT

The minimum specification required by the image exceeds the current instance type.

Last updated