All Products
Search
Document Center

Elastic Compute Service:RedeployInstance

Last Updated:Nov 14, 2024

Redeploys an instance when the instance receives a system event notification.

Operation description

RedeployInstance is an asynchronous operation. This operation migrates data before it restarts the instance. After the instance is redeployed, the instance enters the Running state. If the instance fails to be redeployed, the instance returns to the original physical server and the state before redeployment.

Take note of the following items:

  • The instance must be in the Running or Stopped state. After the instance is redeployed, the following changes occur to the status of the instance:
    • If the instance is in the Running state before redeployment, the instance enters the Stopping state.
    • If the instance is in the Stopped state before redeployment, the instance enters the Starting state.
  • If an instance is deployed on a dedicated host, you cannot redeploy the instance.
  • If the OperationLocks parameter in the response of the DescribeInstances operation contains "LockReason" : "security" for an instance, the instance is locked for security reasons and cannot be redeployed.
  • If you receive notifications about simulated events that are created by calling the CreateSimulatedSystemEvent operation for an instance, you cannot redeploy the instance.
  • If the damaged local disk is isolated but the SystemMaintenance.RebootAndReInitErrorDisk event is not sent when you handle a local disk-related system event for an instance, you can still call the RedeployInstance operation to redeploy the instance. The SystemMaintenance.RebootAndReInitErrorDisk event indicates that the instance is restarted and the damaged disks are reinitialized due to system maintenance. For more information, see System events for ECS instances equipped with local disks.

The following table describes the system events that you can handle by calling the RedeployInstance operation. The table also provides possible event status.

System eventEvent status
Instance restart due to system maintenance (SystemMaintenance.Reboot)Inquiring and Scheduled
Instance redeployment due to system maintenance (SystemMaintenance.Redeploy)Inquiring and Scheduled
Instance restart and replacement of damaged disks due to system maintenance (SystemMaintenance.RebootAndIsolateErrorDisk)Inquiring
Instance restart and re-initialization of damaged disks due to system maintenance (SystemMaintenance.RebootAndReInitErrorDisk)Inquiring
Instance redeployment due to system errors (SystemFailure.Redeploy)Inquiring and Scheduled
For ECS instances that use only local disks: instance restart due to a system error (SystemFailure.Reboot)Executing
Isolation of damaged disks due to system maintenance (SystemMaintenance.IsolateErrorDisk)Inquiring
Re-initialization of damaged disks due to system maintenance (SystemMaintenance.ReInitErrorDisk)Inquiring

NoteWhen instances that use local disks are redeployed, the local disks are re-initialized and data on the local disks is cleared.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ecs:RedeployInstanceupdate
*Instance
acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The ID of the instance.

i-bp1azkttqpldxgted****
ForceStopbooleanNo

Specifies whether to forcefully stop the instance that is in the Running state.

Default value: false.

Note A forced stop is equivalent to a power outage, and unsaved data may be lost. We recommend that you redeploy instances that are in the Stopped state.
false

Response parameters

ParameterTypeDescriptionExample
object
TaskIdstring

The ID of the redeployment task.

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

t-bp10e8orkp8x****
RequestIdstring

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Examples

Sample success responses

JSONformat

{
  "TaskId": "t-bp10e8orkp8x****",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

HTTP status codeError codeError messageDescription
403IncorrectInstanceStatusThe current status of the resource does not support this operation.The resource is in a state that does not support the current operation.
403InstanceLockedForSecurityThe specified operation is denied as your instance is locked for security reasons.-
403DiskErrorIncorrectDiskStatus.The disk state is invalid.
403InstanceExpiredOrInArrearsThe specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode).The subscription instance has expired. You must renew the instance before you can proceed.
403IncorrectInstanceStatus%sThe instance is in a state that does not support the current operation.
403InvalidOperation.RedeployInstance%sThe operation is invalid.
404InvalidInstanceId.NotFoundThe InstanceId provided does not exist in our records.The specified instance does not exist. Check whether the instance ID is correct.
500InternalErrorThe request processing has failed due to some unknown error.An internal error has occurred. Try again later.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history