All Products
Search
Document Center

Elastic Compute Service:RedeployInstance

Last Updated:Jun 18, 2026

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 parameterEvent 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
Note

Redeploying an instance with local disks reinitializes the local disks, and all data on the storage devices is cleared.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ecs:RedeployInstance

update

*Instance

acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}

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.