Tüm Ürünler
Search
Belge Merkezi

:AttachDisk

Son Güncelleme:Oct 02, 2026

Bir ECS örneğine veri diski veya sistem diski bağlar.

Operation description

Bu işlemi çağırırken aşağıdaki hususlara dikkat edin:

  • Örnek ve disk aynı bölgede olmalıdır.

  • Disk Kullanılabilir (Available) durumunda olmalıdır.

  • Bir veri diski bağlarken:

    • Hedef ECS örneği Çalışıyor (Running) veya Durduruldu (Stopped) durumunda olmalıdır.

    • Disk ayrı olarak satın alındıysa, faturalandırma yöntemi kullandıkça öde olmalıdır.

    • Bir ECS örneğinden çıkarılan bir sistem diski, faturalandırma yöntemi kısıtlamaları olmaksızın veri diski olarak bağlanabilir.

    • Çıkarılmış bir elastik geçici disk yalnızca orijinal örneğine yeniden bağlanabilir.

  • Bir sistem diski bağlarken:

    • Hedef ECS örneği, sistem diskinin çıkarıldığı orijinal örnek olmalıdır.

    • Hedef ECS örneği Durduruldu (Stopped) durumunda olmalıdır.

    • Örnek için oturum açma kimlik bilgilerini yapılandırmalısınız.

    • Elastik geçici diskler sistem diski olarak bağlanamaz.

    • Sistem disklerini bağlama hakkında daha fazla bilgi için bkz. Sistem diski çıkarma veya bağlama.

  • ECS örnek bilgilerini sorguladığınızda, yanıt {"OperationLocks": {"LockReason" : "security"}} içeriyorsa, örnek üzerindeki tüm işlemler yasaktır.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ecs:AttachDisk

update

*Disk

acs:ecs:{#regionId}:{#accountId}:disk/{#diskId}

*Instance

acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}

  • ecs:LoginAsNonRoot
  • ecs:PasswordCustomized
None

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

Diski bağlamak istediğiniz ECS örneğinin kimliği.

i-bp1dq5lozx5f4pmd****

DiskId

string

Yes

Bağlanacak diskin kimliği. Disk (DiskId) ve örnek (InstanceId) aynı bölgede olmalıdır.

Not

Hem veri diskleri hem de sistem diskleri bağlanabilir. İlgili kısıtlamalar için yukarıdaki işlem açıklaması bölümüne bakın.

d-bp1j4l5axzdy6ftk****

Device

string

No

Diskin aygıt adı.

Not

Bu parametre yakında kullanımdan kaldırılacaktır. Uyumluluğu artırmak için diski tanımlamak üzere diğer parametreleri kullanın.

testDeviceName

DeleteWithInstance

boolean

No

Örnek serbest bırakıldığında diskin serbest bırakılıp bırakılmayacağını belirtir. Geçerli değerler:

  • true: Disk, örnekle birlikte serbest bırakılır.

  • false: Disk, örnekle birlikte serbest bırakılmaz. Disk, kullandıkça öde veri diski olarak tutulur.

Varsayılan değer: false.

Bu parametreyi yapılandırırken aşağıdaki hususlara dikkat edin:

  • DeleteWithInstance değerini false olarak ayarlarsanız ve ECS örneği güvenlik nedenleriyle kilitlenirse, yani OperationLocks "LockReason" : "security" içeriyorsa, ECS örneği serbest bırakıldığında bu parametre yok sayılır ve disk örnekle birlikte serbest bırakılır.

  • Bağlamak istediğiniz disk bir elastik geçici disk ise, DeleteWithInstance değerini true olarak ayarlamalısınız.

  • Çoklu bağlama özelliği etkinleştirilmiş diskler bu parametreyi desteklemez.

false

Bootable

boolean

No

Diskin sistem diski olarak bağlanıp bağlanmayacağını belirtir. Geçerli değerler:

  • true: Disk, sistem diski olarak bağlanır.

  • false: Disk, sistem diski olarak bağlanmaz.

Varsayılan değer: false.

Not

Bootable=true olarak ayarlarsanız, hedef ECS örneğine bağlı bir sistem diski olmamalıdır.

false

Password

string

No

Bir sistem diski bağladığınızda örnek için ayarlanan parola. Parola yalnızca administrator ve root kullanıcı adları için geçerlidir ve diğer kullanıcı adları için geçerli değildir. Parola 8 ila 30 karakter uzunluğunda olmalı ve aşağıdaki karakter türlerinden en az üçünü içermelidir: büyük harfler, küçük harfler, rakamlar ve özel karakterler. Aşağıdaki özel karakterler desteklenir:

()`~!@#$%^&*-_+=|{}[]:;'<>,.?/

Windows örnekleri için parola eğik çizgi (/) ile başlayamaz.

Not

Password parametresini belirtirseniz, parola sızıntılarını önlemek için isteği HTTPS üzerinden gönderin.

EcsV587!

KeyPairName

string

No

Bir sistem diski bağladığınızda Linux ECS örneğine bağlanan SSH anahtar çiftinin adı.

  • Windows Server örnekleri: SSH anahtar çiftleri desteklenmez. Bu parametre belirtilse bile yalnızca Password yapılandırması etkili olur.

  • Linux örnekleri: Parola tabanlı oturum açma yöntemi varsayılan olarak devre dışıdır.

KeyPairTestName

Force

boolean

No

Diskin zorla bağlanıp bağlanmayacağını belirtir. Geçerli değerler:

  • true: Diski zorla bağlar.

  • false: Diski zorla bağlamaz.

Varsayılan değer: false.

Not

Şu anda, yalnızca bölgesel ESSD'ler (cloud_regional_disk_auto) bu parametrenin true olarak ayarlanmasını destekler.

false

Response elements

Element

Type

Description

Example

object

RequestId

string

İstek kimliği.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Examples

Success response

JSON format

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

HTTP status code

Error code

Error message

Description

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.
400 InvalidOperation.EncryptedDiskUnsupported The specified encrypted disk is not supported for this operation.
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.
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.
403 InvalidInstanceType.NvmeUnsupported The instanceType of the specified instance does not support nvme protocol.
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.
403 InvalidParameter.DeleteWithInstance The DeleteWithInstance for the elastic ephemeral disk must be set to 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.
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.
403 OperationDenied.UnsupportedEncryptedDisk The instance type does not support attaching encrypted disks.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist.
404 InvalidDiskId.NotFound The specified disk does not exist.
404 InvalidDisk.InUse The specified disk has been occupied.
404 DiskAttachedNumberExceeded The attaching times of the specified disk exceeded.
404 InvalidKMSKeyId.NotFound The specified KMSKeyId does not exist. Please verify that the key ID is correct and that the key resides in the current region.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.