ResetInstance

1. API Description

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

Prerequisites

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.

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.

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: `~!@$^*-_=+|;:,.?

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

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.

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.

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 the specified instance by providing an image and password.

`

``json POST /api/v2/zec HTTP/1.1 Host: console.zenlayer.com Content-Type: application/json X-ZC-Action: ResetInstance

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

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

Last updated