You can call this operation to redeploy an ECS instance when the instance receives an event notification.

Description

RedeployInstance is an asynchronous operation. It migrates data before restarting the instance. After the instance is redeployed, it enters the Running (Running) state. If the redeployment fails, the instance returns to the original physical server and recovers to its original state.

When you call this operation, take note of the following points:

  • The target instance must be in the Running or Stopped state. After the redeployment, the instance status changes as follows:
    • If the instance is in the Running (Running) state, it will enter the Stopping (Stopping) state.
    • If the instance is in the Stopped (Stopped) state, it will enter the Starting (Starting) state.
  • Instances on dedicated hosts cannot be redeployed.
  • If the OperationLocks parameter of the instance is set to "LockReason" : "security", the instance is locked for security reasons and cannot be redeployed.
  • If the instance receives simulated events created by calling the CreateSimulatedSystemEvent operation, you cannot redeploy the instance by calling the RedeployInstance operation.
  • When you handle local disk-related system events, if the damaged local disks are isolated but the instance restart due to scheduled system maintenance and re-initialization of the damaged local disk (SystemMaintenance.RebootAndReInitErrorDisk) event is not sent, you can still call the RedeployInstance operation to redeploy the instance. For more information, see Overview of system events on ECS instances equipped with local disks.

The following table lists the system events of specific status that the instance needs to receive before you can call the RedeployInstance operation to redeploy the instance.

System event

Status

Instance restart due to system maintenance (SystemMaintenance.Reboot)

Inquiring, Scheduled

Instance redeployment due to system maintenance (SystemMaintenance.Redeploy)

Inquiring, Scheduled

Instance restart due to scheduled system maintenance and replacement of the damaged local disk (SystemMaintenance.RebootAndIsolateErrorDisk)

Inquiring

Instance restart due to scheduled system maintenance and re-initialization of the damaged local disk (SystemMaintenance.RebootAndReInitErrorDisk)

Inquiring

Instance redeployment due to a system error (SystemFailure.Redeploy)

Inquiring, Scheduled

For instances equipped with local disks only: instance restart due to a system error (SystemFailure.Reboot)

Executing

Warning Redeploying instances with local disks will re-initialize the local disks and clear data in the storage devices.

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 RedeployInstance

The operation that you want to perform. If you use a custom HTTP URL or HTTPS URL to make an API request, you must specify the Action parameter. Set the value to RedeployInstance.

InstanceId String Yes i-bp1azkttqpldxgted****

The ID of the instance that is in the Running or Stopped state.

ForceStop Boolean No false

Specifies whether to forcibly stop the running instance.

Default value: false.

Note The effect of a forced stop is the same as a power failure. Data in the instance operating system that is not written to the storage device may be lost. We recommend that you redeploy instances in the Stopped state.

Response parameters

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

The ID of the request.

TaskId String t-bp10e8orkp********8x

The ID of the redeployment task.

You can call the DescribeTasks operation to query the migration result.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=RedeployInstance
&InstanceId=i-bp1azkttqpldxgted****
&<Common request parameters>

Sample success responses

XML format

<RedeployInstanceResponse>
      <RequestId>1C488B66-B819-4D14-8711-C4EAAA13AC01</RequestId>
      <TaskId>t-bp10e8orkp********8x</TaskId>
</RedeployInstanceResponse>

JSON format

{
    "RequestId": "1C488B66-B819-4D14-8711-C4EAAA13AC01",
    "TaskId":"t-bp10e8orkp********8x"
}

Error codes

HTTP status code Error code Error message Description
404 InvalidInstanceId.NotFound The InstanceId provided does not exist in our records. The error message returned because the specified InstanceId parameter does not exist. Check whether the instance ID is correct.
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 InvalidOperation.RedeployInstance %s The error message returned because the operation is invalid.

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