You can call this operation to restart an instance in the Running state.

Description

  • Only the ECS instances in the Running (Running) state can be restarted.
  • After an instance is restarted, it enters the Starting (Starting) state.
  • Force start (ForceStop) is supported. Force restart is equivalent to powering off traditional servers and then restarting them. This operation can cause data loss if data in the instance operating system is not written to disks.
  • Instances whose OperationLocks array contains the "LockReason" : "security" setting cannot be restarted.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
InstanceId String Yes i-bp67acfmxazb4ph***

The ID of the instance that you want to restart.

Action String No RebootInstance

The operation that you want to perform. Set the value to RebootInstance.

DryRun Boolean No false

Specifies whether to check the request only. Default value: false. Valid values:

  • true: The request is checked and the instance is not restarted. Check items include the request format, service limits, available ECS resources, and whether the required parameters are specified. If the check fails, the corresponding error code is returned. If the check succeeds, the DryRunOperation error code is returned.
  • false: The request is checked, and the instance is restarted if the check succeeds.
ForceStop Boolean No false

Specifies whether to forcibly stop the instance before you restart it. Default value: false. Valid values:

  • true: forcibly stops the instance. This operation is equivalent to the typical power-off operation. Cache data that is not written to storage in the instance will be lost.
  • false: normally stops the instance.

Response parameters

Parameter Type Example Description
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=RebootInstance
&InstanceId=i-bp67acfmxazb4ph***
&ForceStop=false
&<Common request parameters>

Sample success responses

XML format

<RebootInstanceResponse>
      <RequestId>F2E2C40D-AB09-45A1-B5C5-EB9F5C4E4E4A</RequestId>
</RebootInstanceResponse>

JSON format

{
	"RequestId":"F2E2C40D-AB09-45A1-B5C5-EB9F5C4E4E4A"
}

Error codes

HTTP status code Error code Error message Description
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. The error message returned because the specified instance ID does not exist.
403 IncorrectInstanceStatus The current status of the resource does not support this operation. The error message returned because the operation is not supported while the resource is in the current state.
403 InstanceLockedForSecurity The specified operation is denied as your instance is locked for security reasons. The error message returned because the operation is not supported while the instance is locked for security reasons.
403 DiskError IncorrectDiskStatus. The error message returned because the status of the specified disk is invalid.
500 InternalError The request processing has failed due to some unknown error. The error message returned because an internal error has occurred. Try again later. If the problem persists, submit a ticket.
403 InstanceExpiredOrInArrears The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode). The error message returned because the subscription instance has expired. Renew the instance first.
403 IncorrectInstanceStatus %s The error message returned because the operation is not supported while the instance is in the current state.
403 InvalidParameter.KMSKeyId.KMSUnauthorized ECS service have no right to access your KMS. The error message returned because ECS is not authorized to access your KMS resources.
500 InternalError The request processing has failed due to some unknown error, exception or failure. The error message returned because an unknown error has occurred.

For a list of error codes, visit the API Error Center.