ModifyInstanceType

1. API Description

This API is used to modify the specifications of a virtual machine instance.

Note

  • You can only perform this operation on instances whose status is RUNNING orSTOPPED.

  • If the internetChargeType of your instance is PREPAID:

    • Upgrade (target > current) operation will generate an order to be paid and deduct the amount required for this instance purchase. The request takes effect immediately.

    • Downgrade (target < current) operation will generate an order for the next billing cycle and will take effect by then.

  • If the internetChargeType of your instance is POSTPAID:

    • The change takes immediate effect.

  • This API is an async API. Use DescribeInstanceTypeStatus to query specifications of an instance.

  • Rules of specification change:

    • Changes between models with same series are allowed. For example, change the model of c.1c2g to c.2c4g.

    • Some changes between models with different series are allowed. For example, changes between c, g and m series.

    • Some changes between models with different series are not allowed. For example, changes between s and h series.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter NameRequiredTypeDescription

instanceId

Yes

String

ID of the instance to be modified.

To obtain the instance ID, you can call DescribeInstances and look for instanceId in the response.

instanceTypeId

Yes

String

ID of the target model to change.

To obtain the model ID, you can call DescribeZoneInstanceConfigInfos and look for instanceType in the response.

3. Output Parameters

Parameter NameTypeDescription

requestId

String

The unique request ID, which is returned for each request. RequestId is required for locating a problem.

orderNumber

String

Number of order.

4. Code Example

Modify the model of an instance.

POST /api/v2/vm HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: ModifyInstanceType
<Common Request Params>

Request:
{
  "instanceId": "instanceId",
  "instanceTypeId": "c.2c4g"
}

Response:
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {  
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
    "orderNumber": "xxxx"
  }
}

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 CodeError CodeDescription

404

INVALID_INSTANCE_NOT_FOUND

Instance does not exist.

403

INVALID_INSTANCE_TYPE_NOT_CHANGED

Instance model does not changed.

400

OPERATION_FAILED_INSTANCE_TYPE_UNSUPPORTED

Unsupported model for the current instance.

403

OPERATION_DENIED_INSTANCE_EXIST_PLAN

A scheduling change exists.

403

OPERATION_DENIED_INSTANCE_PLAN_PROCESSING

A processing change exists.

400

UNSUPPORTED_OPERATION_INSTANCE_STATUS

Only operations on instances in RUNNING or STOPPED status are supported.

400

UNSUPPORTED_OPERATION_ZONE_NOT_SUPPORT

Specification change is not supported in the current zone.

400

UNSUPPORTED_OPERATION_INSTANCE_BEING_RECYCLE

Operations on instances in recycle bin are not supported.

404

INVALID_PRODUCT_NOT_FOUND

Model does not exist.

Last updated