为一台ECS实例挂载一块按数据盘或系统盘。
接口说明
调用该接口时,您需要注意:
-
实例和磁盘必须在同一个可用区。
-
磁盘的状态必须为待挂载(
Available)。 -
挂载数据盘时:
目标 ECS 实例必须处于运行中(
Running)或者已停止(Stopped)状态。如果是您单独购买的磁盘,计费方式必须是按量付费。
从 ECS 实例上卸载的系统盘作为数据盘挂载时,不限制计费方式。
弹性临时盘一旦卸载,只能重新挂载至其原始实例。
-
挂载系统盘时:
目标 ECS 实例必须是卸载该系统盘时的源实例。
目标 ECS 实例必须处于已停止(
Stopped)状态。您必须设置实例登录凭证。
弹性临时盘不支持挂载为系统盘。
更多关于挂载系统盘的信息,请参见卸载或挂载系统盘。
-
查询 ECS 实例信息时,如果返回数据中包含
{"OperationLocks": {"LockReason" : "security"}},则禁止一切操作。 -
开启多重挂载特性的云盘,只能挂载到支持 NVMe 协议的实例上。 更多信息,请参见ESSD 云盘支持 NVMe以及使用多重挂载功能。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
ecs:AttachDisk |
update |
*Disk
*Instance
|
|
无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| InstanceId |
string |
是 |
待挂载 ECS 实例的 ID。 |
i-bp1dq5lozx5f4pmd**** |
| DiskId |
string |
是 |
待挂载的磁盘 ID。磁盘( 说明
支持挂载数据盘和系统盘,相关约束条件请参见上文接口说明部分。 |
d-bp1j4l5axzdy6ftk**** |
| Device |
string |
否 |
磁盘设备名称。 说明
该参数即将被弃用,为提高兼容性,建议您尽量使用其他参数标识磁盘。 |
testDeviceName |
| DeleteWithInstance |
boolean |
否 |
释放实例时,该磁盘是否随实例一起释放。取值范围:
默认值:false。 设置该参数时,您需要注意:
|
false |
| Bootable |
boolean |
否 |
是否作为系统盘挂载。取值范围:
默认值:false。 说明
设置为 |
false |
| Password |
string |
否 |
挂载系统盘时,设置实例的用户名密码,仅对 administrator 和 root 用户名生效,其他用户名不生效。长度为 8 至 30 个字符,必须同时包含大小写英文字母、数字和特殊符号中的三类字符。特殊符号可以是:
其中,Windows 实例不能以斜线号(/)为密码首字符。 说明
如果传入 |
EcsV587! |
| KeyPairName |
string |
否 |
挂载系统盘时,为 Linux 系统 ECS 实例绑定的 SSH 密钥对的名称。
|
KeyPairTestName |
| Force |
boolean |
否 |
是否是强制挂载请求。取值范围:
默认值:false。 说明
当前仅 ESSD 同城冗余类型(cloud_regional_disk_auto)支持设置该字段为 true。 |
false |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| RequestId |
string |
请求 ID。 |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
示例
正常返回示例
JSON格式
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
异常返回示例
JSON格式
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | InvalidDevice.Malformed | The specified device is not valid. | |
| 400 | IncorrectInstanceStatus | The current status of the resource does not support this operation. | 该资源目前的状态不支持此操作。 |
| 400 | InvalidParameter | The input parameter is mandatory for processing this request is empty. | 参数不能为空。 |
| 400 | InvalidRegionId.MalFormed | The specified RegionId is not valid. | |
| 400 | InvalidOperation.InstanceTypeNotSupport | The instance type of the specified instance does not support hot attach disk. | 磁盘挂载的实例不支持磁盘热插拔操作。 |
| 400 | DiskCategory.OperationNotSupported | The operation is not supported to the specified disk due to its disk category. | 由于磁盘种类限制,指定的磁盘不支持该操作。 |
| 400 | InvalidDisk.DiskNotBootable | The specified disk is not a bootable disk. It cannot be attached as a system disk. | |
| 400 | InvalidInstance.NotOriginInstance | The specified disk can not attached to other instance as system disk. | |
| 400 | InvalidParameterForce.DiskCategoryNotSupported | The specified disk category does not support force attach operation. | 指定的磁盘类型不支持强制挂载操作 |
| 400 | InvalidParameterForce.PrepaidDiskNotSupported | The prepaid disk does not support force attach operation. | 预付费磁盘不支持强制挂载操作 |
| 400 | InvalidParameterForce.MultiAttachDiskNotSupported | The multi attach disk does not support force attach operation. | 多重挂载磁盘不支持强制挂载操作 |
| 400 | InvalidParameterForce.RegionNotSupported | The specified region does not support force attach operation. | 该地域不支持强制挂载操作 |
| 400 | OperationConflict.DisksAttachingParallellyExceed | The number of disks attaching parallelly exceeds the limit. | 并行挂载的磁盘个数超过限制 |
| 400 | InvalidInstanceType.NotSupported | The specified instanceType is not supported by the image architecture. | 指定的镜像架构不支持此实例规格。 |
| 500 | InternalError | The request processing has failed due to an internal error and you may retry later or contact support with the request ID. | |
| 403 | InstanceDiskLimitExceeded | The number of disks attached to the instance has exceeded the limit. | |
| 403 | InvalidDevice.InUse | The specified device has been occupied. | |
| 403 | DiskNotPortable | The specified disk is not a portable disk. | |
| 403 | InstanceLockedForSecurity | The instance is locked due to security. | 您的资源被安全锁定,拒绝操作。 |
| 403 | ResourcesNotInSameZone | The specified instance and disk are not in the same zone. | |
| 403 | InstanceExpiredOrInArrears | The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode). | |
| 403 | DiskInArrears | The specified operation is denied because the disk has overdue payments. Please settle the outstanding balance. | |
| 403 | DiskError | IncorrectDiskStatus. | |
| 403 | DiskId.ValueNotSupported | The specified parameter diskid is not supported. | 指定的块存储类型不支持此操作。 |
| 403 | DiskId.StatusNotSupported | The specified disk status is not supported. | 当前磁盘的状态不支持此操作。 |
| 403 | IncorrectInstanceStatus.NotSupportESSD | The operation is not supported in this status. Please reboot the instance. | |
| 403 | IncorrectDiskStatus | The operation is not supported in this status. | 当前的磁盘不支持此操作,请您确认磁盘处于正常使用状态,是否欠费。 |
| 403 | UserNotInTheWhiteList | The user is not in disk white list. | 您不在磁盘白名单中,请加入白名单后重试。 |
| 403 | InvalidParameter.KMSKeyId.CMKNotEnabled | The CMK needs to be enabled. | |
| 403 | InvalidParameter.KMSKeyId.CMKUnauthorized | The CMK has not authorized the ECS service to perform the KMS TagResource and UntagResource operations. Please verify the authorization and try again. | |
| 403 | InvalidParameter.KMSKeyId.KMSUnauthorized | ECS service does not have permission to access your KMS key. Please verify that the specified KMS key has authorized the ECS service. | |
| 403 | DependencyViolation.WindowsInstance | The instance image is Windows. SSH key pair login is not supported. | |
| 403 | InvalidInstanceType.NotSupportDiskCategory | The instanceType of the specified instance does not support this disk category. | 指定的实例规格(InstanceType)不支持当前实例的云盘类别。请尝试更换其它实例规格。关于实例规格支持的云盘类型,请参见实例规格族文档。 |
| 403 | InvalidInstanceType.NotSupportPL0 | The instanceType of the specified instance does not support PL0 of cloud_essd. | |
| 403 | InvalidInstanceType.NvmeRequired | The instanceType of the specified instance requires nvme protocol. | 指定实例的规格要求使用 NVMe 协议。 |
| 403 | InvalidInstanceType.NvmeUnsupported | The instanceType of the specified instance does not support nvme protocol. | 指定实例的规格不支持 NVMe 协议。 |
| 403 | InvalidInstanceType.NotSupportMultiAttachDisk | The instanceType of the specified instance does not support multi attach disk. | 指定的实例规格不支持挂载开启多重挂载特性的云盘。 |
| 403 | DiskAttachedNumberExceeded | The attaching times of the specified disk exceeded. | 指定的云盘所挂载的实例数量已达上限。 |
| 403 | InvalidOperation.CanNotAttachMultiAttachDiskAsSystemDisk | Multi attach disk can not be attached as system disk. | 开启多重挂载特性的云盘不支持作为系统盘使用。 |
| 403 | DeleteWithInstance.Conflict | Multi attach disk cannot be set to DeleteWithInstance attribute. | 开启多重挂载特性的云盘不支持设置 DeleteWithInstance。 |
| 403 | InvalidParameter.DeleteWithInstance | The DeleteWithInstance for the elastic ephemeral disk must be set to true. | 弹性临时盘的 DeleteWithInstance 属性必须设置为 true。 |
| 403 | InvalidOperation.OtherInstanceUnsupported | The elastic ephemeral disk can only be attached to the instance it was last mounted on. Please check the disk system tag to get the last associated instance. | |
| 403 | InvalidInstance.ZoneConflict | The force attach operation is not supported when both the current and target instances are in the same zone. | 强制挂载要求当前实例与目标实例处于不同可用区 |
| 403 | InvalidParameter.AllEmpty | The current operation requires either a password or a keyPairName to must be provided. Please ensure that at least one of them is not empty. | 当前操作不允许password和keyPairName同时为空,确保password或者keyPairName有一个不为空。 |
| 403 | InvalidOperation.DiskQueueNumberNotEnough | The number of disk queues on the instance is not enough. | 实例上的磁盘队列数不足。 |
| 403 | InvalidOperation.DiskAttachModeUnsupported | The instance type does not support the disk attach mode. | 当前实例规格不支持磁盘的挂载模式 |
| 403 | OperationDenied.HpnZoneMismatch | Instance and disk must be in the same HPN zone for restricted HPN zones. | 对于部分受限的HPN区域,实例与磁盘必须位于同一HPN区域内才可执行挂载操作。 |
| 403 | OperationDenied.UnsupportedEncryptedDisk | The instance type does not support attaching encrypted disks. | 实例的规格不支持挂载加密盘。 |
| 404 | InvalidInstanceId.NotFound | The specified InstanceId does not exist. | 指定的实例ID无效。 |
| 404 | InvalidDiskId.NotFound | The specified disk does not exist. | 指定的磁盘不存在。请您检查磁盘 ID 是否正确。 |
| 404 | InvalidDisk.InUse | The specified disk has been occupied. | |
| 404 | DiskAttachedNumberExceeded | The attaching times of the specified disk exceeded. | |
| 404 | InvalidKMSKeyId.NotFound | The KMS key used by the disk does not exist. | 磁盘使用的 KMS 密钥不存在. |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。