Restarts an instance that is in the Running state.

Description

  • Only instances that are in the Running state can be restarted.
  • After this operation is called, the status of the instance changes to Starting.
  • An instance can be forcibly restarted. A forced restart (ForceStop) is equivalent to performing a hard restart. This operation can cause data loss if data in the instance is not written to the disk.
  • If you call the DescribeInstances operation to query the details of an instance and OperationLocks in the response contains "LockReason": "security", the instance is locked for security reasons and cannot be stopped. For more information, see API behavior when an instance is locked for security reasons.

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
Action String Yes RebootInstance

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

InstanceId String Yes i-bp67acfmxazb4ph****

The ID of the instance.

ForceStop Boolean No false

Specifies whether to forcibly stop the instance to restart it. Valid values:

  • true: stops the instance in a forceful manner. This operation is equivalent to performing a hard shut-down. Cache data that is not written to persistent storage will be lost.
  • false: normally stops the instance. This is the default value.
DryRun Boolean No false

Specifies whether to perform a dry run. Valid values:

  • true: performs a dry run. The system checks the required parameters, the request format, service limits, and available ECS resources. If the request fails the dry run, an error message is returned. If the request passes the dry run, the DryRunOperation error code is returned.
  • false: performs a dry run and sends the request. If the request passes the dry run, the instance is restarted.

Default value: false.

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 response

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

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

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

HttpCode Error code Error message Description
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 instance 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 state of the specified disk is invalid.
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 and try again.
403 IncorrectInstanceStatus %s The error message returned because the operation is not supported while the instance is in the current state.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. The error message returned because the specified instance does not exist. Check whether the specified InstanceId parameter is valid and try again.
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.
500 InternalError The request processing has failed due to some unknown error, exception or failure. The error message returned because an internal error has occurred. Try again later.

For a list of error codes, see Service error codes.