ResetInstance

1. API Description

This API is used to reinstall the operating system on an elastic compute instance.

Prerequisites

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

instanceId

Yes

String

Instance ID(s).

imageId

No

String

password

No

String

Instance password.

The parameter must be 8-16 characters, including:

  • lowercase letters: [a-z]

  • uppercase letters: [A-Z]

  • digits: 0-9

  • special characters: ~!@$^*-_=+

keyId

No

String

Key pair ID. Specify either a password or a key pair, not both.

timezone

No

String

If not specified, the instance will be reinstalled using its original time zone.

enableAgent

No

String

Whether QGA is enabled or not.

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

Reinstall the specified instance by providing an image and password.

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

Request:
{
    "instanceId": "instanceId",
    "imageId": "image-xxxxxxxxx",
    "password": "Example+123"
}

Response:
{
  "requestId": "TC1748D3E-452D-4F74-8485-7AA73718E453",
  "response": {
    "requestId": "TC1748D3E-452D-4F74-8485-7AA73718E453"
  }
}

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 does not exist.

404

INVALID_IMAGE_NOT_FOUND

The specified image does not exist.

400

INVALID_PASSWORD_MALFORMED

Invalid password. The specified password does not meet the password complexity limit. For example, the password length does not meet the limit.

400

UNSUPPORTED_OPERATION_INSTANCE_STATUS

Operations on the instances in the current state are not supported.

400

INVALID_IMAGE_SIZE_EXCEED

The selected boot disk size is less than the size required for the image.

400

INVALID_IMAGE_TYPE_NOT_SAME

The selected image type is different from the original image.

400

INVALID_IMAGE_AGENT_NOT_SUPPORT

QGA is not supported on the selected image.

404

INVALID_PASSWORD_KEY_PAIR_NOT_FOUND

No password or keyId specified.

403

INVALID_REGION_KEY_PAIR_NOT_SUPPORT

keyPair is not supported in the selected region.

Last updated