Invokes the RedeployInstance operation to redeploy an ECS instance when the ECS instance receives a system event notification.
Operation description
Operation description
RedeployInstance is an asynchronous invocation that restarts and migrates an instance. After the redeployment succeeds, the instance enters the Running state. If the redeployment fails, the instance is returned to the original physical server and recovers to the state before the redeployment.
When you invoke this operation, take note of the following items:
- The target instance must be in the Running or Stopped state. The instance status changes after the operation is invoked:
An instance in the Running (
Running) state enters the Stopping (Stopping) state.An instance in the Stopped (
Stopped) state enters the Starting (Starting) state.
Instances on dedicated hosts cannot be redeployed.
If the OperationLocks of an instance is marked with
"LockReason": "security", the instance cannot be redeployed.Simulated events created by invoking CreateSimulatedSystemEvent cannot be responded to.
During the flow of isolating a local disk in a system event, you can also invoke RedeployInstance if the damaged local disk has been isolated but the SystemMaintenance.RebootAndReInitErrorDisk event has not been issued. For more information, see Overview of system events for instances with local disks.
The following table describes the system event types and event states that RedeployInstance can respond to.
| Event name and parameter | Event status |
| Instance restart due to system maintenance (SystemMaintenance.Reboot) | Inquiring, Scheduled |
| Instance redeployment due to system maintenance (SystemMaintenance.Redeploy) | Inquiring, Scheduled |
| Instance restart and damaged disk replacement due to system maintenance (SystemMaintenance.RebootAndIsolateErrorDisk) | Inquiring |
| Instance restart and damaged disk reinitialization due to system maintenance (SystemMaintenance.RebootAndReInitErrorDisk) | Inquiring |
| Instance redeployment due to system fault (SystemFailure.Redeploy) | Inquiring |
| For ECS instances with local disks only: instance restart due to system fault (SystemFailure.Reboot) | Executing |
| Damaged disk isolation due to system maintenance (SystemMaintenance.IsolateErrorDisk) | Inquiring |
| Damaged disk reinitialization due to system maintenance (SystemMaintenance.ReInitErrorDisk) | Inquiring |
Redeploying an instance with local disks reinitializes the local disks, and all data on the storage devices is cleared.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ecs:RedeployInstance |
update |
*Instance
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
Yes |
The instance ID of the instance that is in the Running or Stopped state. |
i-bp1azkttqpldxgted**** |
| ForceStop |
boolean |
No |
Specifies whether to forcefully stop the instance that is in the Running state. Default value: false. Note
A forced stop is equivalent to a typical server power-off. Data in the instance operating system that has not been written to storage devices is lost. We recommend that you redeploy instances that are already stopped. |
false |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| TaskId |
string |
The ID of the redeployment task. You can call the DescribeTasks operation to query the migration result. |
t-bp10e8orkp8x**** |
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
Examples
Success response
JSON format
{
"TaskId": "t-bp10e8orkp8x****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 403 | IncorrectInstanceStatus | The current status of the resource does not support this operation. | |
| 403 | InstanceLockedForSecurity | The specified operation is denied as your instance is locked for security reasons. | |
| 403 | DiskError | IncorrectDiskStatus. | |
| 403 | InstanceExpiredOrInArrears | The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode). | |
| 403 | InvalidOperation.RedeployInstance | %s | The operation is invalid. |
| 404 | InvalidInstanceId.NotFound | The InstanceId provided does not exist in our records. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.