Skip to main content

AttachDisk

Description

Call the AttachDisk to mount a data disk or a system disk for an ECS instance. The instance and the cloud disk must be in the same zone.

Request Method

POST

Request Path

/apsara/route/Ecs/AttachDisk

Request Parameters Common Parameters

NameLocationTypeRequiredSample valueDescription
KeyPairNameBODYstringNotest-KeyPairNameThe name of the SSH key pair bound to the Linux system ECS instance when the system disk is mounted. Windows Server system: SSH key pair is not supported. Even if this parameter is filled in, only Password is executed. Linux system: the password login method will be initialized to be prohibited.
InstanceIdBODYstringYesi-bp1ahcvgu9z55pk7****ID of the target ECS instance.
regionIdBODYstringYesNo sample value for this parameter.region id
DeviceBODYstringNotestNamecloud disk device name. Description This parameter is about to be deprecated. To improve compatibility, it is recommended that you use other parameters as much as possible.
DeleteWithInstanceBODYbooleanNofalseWhen an instance is released, whether the cloud disk is released with the instance. true: release. false: not released. default value: false. description set DeleteWithInstance to false, once the ECS instance is safely controlled, that is, OperationLocks marked "LockReason" : "security", when the ECS instance is released, this attribute of the cloud disk will be ignored and released at the same time.
BootableBODYbooleanNofalsewhether it is mounted as a system disk. default value: false. description set to Bootable = true, the target ECS instance must be in a system disk-free state.
versionBODYstringNo2016-01-01version of api
DiskIdBODYstringYesd-bp198f7xn673w2rw****cloud disk ID to be mounted. Cloud disk (DiskId) and instance (InstanceId) must be in the same zone. description supports mounting data disks and system disks. for related constraints, please refer to the interface description section above.
PasswordBODYstringNoEcsV587!When mounting the system disk, set the user name and password of the instance, which only takes effect for the administrator and root user names, but not for other user names. It is 8 to 30 characters in length and must contain both uppercase and lowercase letters, numbers, and special symbols. Special symbols can be: ()'~! @#$%^&*-_+=|{}[]:;'<> ;,?//code>/pre> p data-tag = "p" class = "p"> where the Windows instance cannot use the slash (/) as the first character of the password. description if you pass in Password parameter, it is recommended that you use HTTPS protocol to send requests to avoid password disclosure.

Return data

NameTypeSample valueDescription
RequestIDstring1E3D5A1E0-67CA-43DA-24BC-EAF2D5A1E4DCRequest id

Example

Successful Response example

{
"RequestID":"1E3D5A1E0-67CA-43DA-24BC-EAF2D5A1E4DC"
}

Failed Response example

{
"errorSample":
{
"resultCode":-1,
"resultMsg":"system error",
"result":null
}

}