Modifies the deployment set of an Elastic Compute Service (ECS) instance or migrates an instance to a dedicated host. You can change the instance type of an instance when you migrate the instance.
Description
When you call this operation, take note of the following items:
- The instance must be in the Stopped (Stopped) state before it is migrated. 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 dedicated host 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 or preemptible instances from a shared host to a dedicated host.
- You can redeploy an ECS instance to a specific dedicated host cluster.
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | ModifyInstanceDeployment |
The operation that you want to perform. Set the value to ModifyInstanceDeployment. |
RegionId | String | Yes | cn-hangzhou |
The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list. |
InstanceId | String | Yes | i-bp67acfmxazb4ph*** |
The ID of the instance. |
DedicatedHostId | String | No | dh-bp67acfmxazb4ph**** |
The ID of the dedicated host. You can call the DescribeDedicatedHosts operation to query the available 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:
For more information about the automatic deployment feature, see Features of dedicated hosts. |
DeploymentSetId | String | No | ds-bp67acfmxazb4ph**** |
The ID of the deployment set. This parameter is required when you add an ECS instance to a deployment set or change the deployment set of an instance. Note You cannot change the deployment set when you modify the dedicated host-related parameters,
including
Tenancy , Affinity , and DedicatedHostId .
|
Force | Boolean | No | false |
Specifies whether to forcibly change the host of the instance. Valid values:
Default value: false. |
Affinity | String | No | host |
Specifies whether to associate the instance with a dedicated host. Valid values:
If you want to migrate the instance from a shared host to a dedicated host, use the default value. Default value: default. |
Tenancy | String | No | host |
Specifies whether to deploy the instance on a dedicated host. Set the value to host to deploy the instance on a dedicated host. |
MigrationType | String | No | live |
Specifies whether to stop the instance before it is migrated to the destination dedicated host. Valid values:
Default value: reboot. |
InstanceType | String | No | ecs.c6.large |
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.
|
DedicatedHostClusterId | String | No | dc-bp67acfmxazb4ph**** |
The ID of the dedicated host cluster. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 04F0F334-1335-436C-A1D7-6C044FE73368 |
The ID of the request. |
Examples
Sample requests
https://ecs.aliyuncs.com/?Action=ModifyInstanceDeployment
&InstanceId=i-bp67acfmxazb4ph****
&RegionId=cn-hangzhou
&DedicatedHostId=dh-bp67acfmxazb4ph****
&Tenancy=host
&MigrationType=live
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<ModifyInstanceDeploymentResponse>
<RequestId>04F0F334-1335-436C-A1D7-6C044FE73368</RequestId>
</ModifyInstanceDeploymentResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "04F0F334-1335-436C-A1D7-6C044FE73368"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | OperationDenied.UnstoppedInstance | Operation denied due to unstopped instance. | The error message returned because the current operation is invalid. Check whether the instance is in the Stopped state. |
400 | InvalidDedicatedHostStatus.NotSupport | Operation denied due to dedicated host status. | The error message returned because the operation is not supported while the dedicated host is in the current state. |
400 | InvalidPeriod.ExceededDedicatedHost | Instance expired date can't exceed dedicated host expired date. | The error message returned because the expiration date of the instance is later than that of the dedicated host. |
400 | InvalidParam.Tenancy | The specified Tenancy is invalid. | The error message returned because the specified Tenancy parameter is invalid. |
400 | ChargeTypeViolation.PostPaidDedicatedHost | Prepaid instance onto postpaid dedicated host is not allowed. | The error message returned because subscription instances cannot be deployed on pay-as-you-go dedicated hosts. |
400 | InvalidDedicatedHostId.NotFound | The specified DedicatedHostId does not exist. | The error message returned because the specified DedicatedHostId parameter does not exist. |
400 | InvalidInstanceType.ValueNotSupported | The specified InstanceType does not exist or beyond the permitted range. | The error message returned because the specified InstanceType parameter does not exist or because you are not authorized to manage instances of this instance type. |
403 | IncorrectInstanceStatus | %s | The error message returned because the operation is not supported while the instance is in the current state. |
403 | OperationDenied.NoStock | The resource is out of usage. | The error message returned because the instance is not in the Running state. Start the instance or check whether the operation is valid. |
404 | InvalidInstanceId.NotFound | The specified InstanceId does not exist. | The error message returned because the specified InstanceId parameter does not exist. Check whether the instance ID is correct. |
404 | InvalidInstanceNetworkType.NotSupport | The specified Instance network type not support. | The error message returned because the network type of the specified instance does not support this operation. |
404 | InvalidInstanceType.NotSupport | The Dedicated host not support the specified instance type. | The error message returned because the current dedicated host does not support the specified instance type. |
For a list of error codes, visit the API Error Center.