All Products
Search
Document Center

Elastic Compute Service:ModifyInstanceDeployment

Last Updated:Mar 13, 2024

Changes the deployment set of an Elastic Compute Service (ECS) instance or migrates an ECS instance to a dedicated host. When you migrate the ECS instance, you can change the instance type of the instance.

Operation description

Take note of the following items:

  • The instance must be in the Stopped (Stopped) state. The instance is automatically restarted after it is migrated.
  • The network type of the instance must be Virtual Private Cloud (VPC).
  • The instance and the destination dedicated host to which to migrate the instance must belong to the same account and reside in the same region and zone.
  • A pay-as-you-go instance can be migrated to a subscription dedicated host. A subscription instance can be migrated only between subscription dedicated hosts. The expiration date of the subscription instance cannot be later than that of the destination dedicated host.
  • You can migrate only pay-as-you-go instances from a shared host to a dedicated host. You cannot migrate subscription instances or preemptible instances from a shared host to a dedicated host.
  • You can redeploy an instance to a specific dedicated host cluster.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
InstanceIdstringYes

The ID of the instance.

i-bp67acfmxazb4ph***
DedicatedHostIdstringNo

The ID of the destination dedicated host. You can call the DescribeDedicatedHosts operation to query the most recent list of dedicated hosts.

When you migrate an instance from a shared host to a dedicated host or between dedicated hosts, take note of the following items:

  • To migrate the instance to a specific dedicated host, specify this parameter.
  • To migrate the instance to a system-selected dedicated host, leave this parameter empty and set Tenancy to host.

For information about the automatic deployment feature, see Functions and features.

dh-bp67acfmxazb4ph****
DeploymentSetIdstringNo

The ID of the destination deployment set.

This parameter is required when you add an instance to a deployment set or change the deployment set of an instance.

Note You cannot change the deployment set when you modify dedicated host configurations, including the Tenancy, Affinity, and DedicatedHostId parameters.
ds-bp67acfmxazb4ph****
DeploymentSetGroupNointegerNo

The number of the deployment set group in which to deploy the instance in the destination deployment set. This parameter is valid only when the destination deployment set uses the high availability group strategy (AvailabilityGroup). Valid values: 1 to 7.

Note If you call this operation to deploy an instance to a deployment set that uses the high availability group strategy (AvailablilityGroup) and leave this parameter empty, the system evenly distributes instances among the deployment set groups in the deployment set. If you call this operation to change the deployment set of an instance and specify the current deployment set of the instance as the destination deployment set, the system evenly distributes instances again among the deployment set groups in the deployment set.
3
ForcebooleanNo

Specifies whether to forcefully change the host of the instance when the deployment set of the instance is changed. Valid values:

  • true: forcefully changes the host of the instance when the deployment set of the instance is changed. Hosts can be forcefully changed only for instances in the Running (Running) or Stopped (Stopped) state. The instances that are in the Stopped (Stopped) state do not include pay-as-you-go instances that are stopped in economical mode.

    **

    NoteIf the specified instance has local disks attached, the local disks are forcefully changed when the host of the instance is forcefully changed. This may cause data loss in the local disks. Proceed with caution.

  • false: does not forcefully change the host of the instance when the deployment set of the instance is changed. You can add the instance to a deployment set only when the instance remains on the current host. When the Force parameter is set to false, the deployment set may fail to be changed.

Default value: false.

false
AffinitystringNo

Specifies whether to associate the instance with a dedicated host. Valid values:

  • host: associates the instance with a dedicated host. When you start a stopped instance in economical mode, the instance remains on its original dedicated host.
  • default: does not associate the instance with a dedicated host. When you start a stopped instance in economical mode, the instance can be automatically deployed to another dedicated host in the automatic deployment resource pool if the resources of the original dedicated host are insufficient.

If you want to migrate the instance from a shared host to a dedicated host, use the default value. Default value: default.

host
TenancystringNo

Specifies whether to deploy the instance on a dedicated host. Set the value to host, which indicates that the instance is deployed on a dedicated host.

host
MigrationTypestringNo

Specifies whether to stop the instance before it is migrated to the destination dedicated host. Valid values:

  • reboot: stops the instance before it is migrated.
  • live: migrates the instance without stopping it. If you set MigrationType to live, you must specify DedicatedHostId. In this case, you cannot change the instance type of the instance when the instance is migrated.

Default value: reboot.

live
InstanceTypestringNo

The instance type to which the instance is changed. You can call the DescribeInstanceTypes operation to query the most recent list of instance types.

You can change the instance type of an instance when you migrate the instance to a dedicated host. The new instance type must match the type of the specified dedicated host. For more information, see Dedicated host types.

  • If you specify this parameter, you must also specify DedicatedHostId.
  • You cannot change the instance type of an instance if you use the automatic deployment feature to migrate the instance.
ecs.c6.large
DedicatedHostClusterIdstringNo

The ID of the dedicated host cluster.

dc-bp67acfmxazb4ph****
RemoveFromDeploymentSetbooleanNo

Specifies whether to remove the specified instance from the specified deployment set. Valid values:

  • true
  • false

Default value: false.

Note If you set this parameter to true, you must specify InstanceId and DeploymentSetId and make sure that the specified instance belongs to the specified deployment set.
false

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

04F0F334-1335-436C-A1D7-6C044FE7****

Examples

Sample success responses

JSONformat

{
  "RequestId": "04F0F334-1335-436C-A1D7-6C044FE7****"
}

Error codes

HTTP status codeError codeError messageDescription
400OperationDenied.UnstoppedInstanceOperation denied due to unstopped instance.The operation is invalid. Check whether the instance is stopped.
400InvalidDedicatedHostStatus.NotSupportOperation denied due to dedicated host status.-
400InvalidPeriod.ExceededDedicatedHostInstance expired date can't exceed dedicated host expired date.-
400NoAvaliableDedicatedHostThere's no enough resource on the specified dedicated host.-
400OperationDenied.LocalDiskInstanceOperation denied due to instance has local disk.-
400NoAvaliableDedicatedHostThere's no enough dedicated host resource.-
400InvalidParameter.ParamRequested param is invalid.-
400InvalidParam.TenancyThe specified Tenancy is invalid.The specified Tenancy parameter is invalid.
400InvalidParam.DedicatedHostIdThe specified dedicated host id is the same with present host id!-
400InvalidDedicatedHost.NotEnoughResourceThere's no available dedicated host to perform the operation.-
400OperationDenied.InvalidInstanceThe specified instance is not dedicated instance.The specified instance is not deployed on a dedicated host.
400ChargeTypeViolation.PostPaidDedicatedHostPrepaid instance onto postpaid dedicated host is not allowed.-
400OperationDenied.NotSupportEcs on dedicatedHost has been migrated.-
400InvalidDedicatedHostId.NotFoundThe specified DedicatedHostId does not exist.-
400InvalidParam.DedicatedHostIdParameter dedicated host id must been provided in such operation.-
400OperationDenied.CannotPerformLive migration cannot be performed.Hot migration cannot be performed.
400InvalidInstanceType.ValueNotSupportedThe specified InstanceType does not exist or beyond the permitted range.The specified instance type does not exist or you are not authorized to manage instances of this instance type.
400InvalidParameter.TenancyThe specified Tenancy is invalid.-
400InvalidParameter.AffinityThe specified Affinity is invalid.-
400InvalidInstanceType.NotSupportThe parameter EcsMigrationType conflict with InstanceType, live migration do not support InstanceType alter on ddh.-
400InvalidParam.InstanceIdThe specified InstanceId should be on dedicatedHost.-
400InvalidDedicatedHostClusterId.NotFoundThe specified DedicatedHostClusterId does not exist.-
400InvalidDedicatedHostClusterId.InvalidThe specified Dedicated Host Cluster is invalid.-
400InvalidDestinationZone.DeploymentSetMismatchError happened, %s.-
403IncorrectInstanceStatus%sThe instance is in a state that does not support the current operation.
403OperationDenied.NoStockThe resource is out of usage.The instance is not in the Running state. Start the instance or check whether the specified operation is valid.
404InvalidDeploymentSetId.NotFoundThe specified deployment set does not exist.-
404InvalidInstanceId.NotFoundThe specified InstanceId does not exist.The specified instance does not exist.
404InvalidInstanceNetworkType.NotSupportThe specified Instance network type not support.The operation is not supported while the instance is of the current network type.
404InvalidInstanceChargeType.NotSupportThe Dedicated host not support the specified instance charge type.This dedicated host does not support instances that use the specified billing method.
404InvalidInstanceType.NotSupportThe Dedicated host not support the specified instance type.The dedicated host does not support the specified instance type.
404InvalidParameter.DeploymentSetGroupNoParameter DeploymentSetGroupNo is invalid.-
404InvalidDedicatedHostId.NotSupportCannot choose instance present host as destination host.-
404InvalidDedicatedHost.NotFoundNo available host.-
404InvalidDedicatedHost.ZoneNotMatchThe specify dedicated host zone location not match the instance zone location.-
404InvalidOperation.NotSupportThe specified DedicatedHost operation not supported on MPS.-

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

Change history

Change timeSummary of changesOperation
2024-01-30The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 403 change
    delete Error Codes: 400
    delete Error Codes: 404
2023-06-20The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 403
    delete Error Codes: 404
2022-06-10The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 403
    delete Error Codes: 404
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: RemoveFromDeploymentSet