ResetInstance

1. API Description

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

Prerequisites

circle-info

Note

  • If the imageId parameter is specified, the instance will be reinstalled using the specified image; otherwise, it will be reinstalled with its current image.

  • The boot disk size of the instance must be greater than or equal to the size of the reinstalled image. Otherwise, the operation will fail.

  • The boot disk will be formatted and reset. Make sure there are no important files in the boot disk.

  • Specify either a password or a key pair, not both.

  • Only operations on instances that are in powered-off state are supported.

  • After reinstallation, the instance enters the DEPLOYING state. If the latest status of the instance changes to RUNNING, it means that the operation is successful. If it changes to REINSTALL_FAILED, it means that the operation has failed. Please contact the administrator. You can call DescribeInstancesStatus to query the instance status.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

instanceId

Yes

String

Instance ID(s).

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

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

SSH key pair ID. For example: key-YWD2QFOl .

Your SSH key pair contains several public keys that can be placed on your server. You can access your instance with the private key. Call DescribeKeyPairs to obtain key pair information.

You can set either a password or a keyId , but not both; Windows and Generic images support neither option.

imageId

No

String

Specify a valid image ID.

To obtain valid image ID, you can call DescribeImages and look for imageId in the response. You can also reinstall it according to the original image.

timezone

No

String

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

enableAgent

No

Boolean

Whether QGA is enabled or not.

Default value: false

instanceName

No

String

The modified instance name.

2–63 characters in length.

Only letters, numbers, hyphens (-), and periods (.) are allowed.

userData

No

String

Initialization command.

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

{% tabs %} {% tab title="Example" %}

Reinstall operating system.

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

400

INVALID_IMAGE_AGENT_NOT_SUPPORT

QGA is not supported for the selected image.

400

INVALID_IMAGE_KEY_PAIR_NOT_SUPPORT

The image does not support SSH key pairs.

404

INVALID_IMAGE_NOT_FOUND

Image not found.

400

INVALID_IMAGE_PASSWORD_NOT_SUPPORT

The operating system does not support the specified password.

400

INVALID_IMAGE_SIZE_EXCEED

Boot disk size should be larger than the image size.

400

INVALID_IMAGE_STATUS

The image's state does not support this operation.

400

INVALID_OS_TYPE_NOT_SAME

Operating system types are inconsistent, operation not allowed.

400

INVALID_PARAMETER_USER_DATA_EXCEED

Initialization command exceeds length limit.

404

INVALID_INSTANCE_NOT_FOUND

Instance not found.

404

INVALID_KEY_PAIR_NOT_FOUND

SSH key pair does not exist.

400

INVALID_KEY_PAIR_NOT_SUPPORT

Unsupported SSH key pair exists.

400

INVALID_LOGIN_SETTING_CONFLICT

You must and can only pass the value of either password or keyId .

400

INVALID_PASSWORD_MALFORMED

Password format error.

400

UNSUPPORTED_OPERATION_INSTANCE_STATUS

Operations on instances in current state are not supported.

Last updated