All Products
Search
Document Center

Elastic Compute Service:AttachDisk

Last Updated:Jun 12, 2026

Menyambungkan disk data atau disk sistem ke Instans ECS.

Deskripsi operasi

Saat memanggil operasi ini, perhatikan hal-hal berikut:

  • Instans dan disk harus berada di zona yang sama.

  • Disk harus berada dalam status Unattached (Available).

  • Saat menyambungkan disk data:

    • Instans ECS target harus berada dalam status Running (Running) atau Stopped (Stopped).

    • Jika disk dibeli secara terpisah, metode penagihannya harus pay-as-you-go.

    • Saat disk sistem yang telah dilepas dari Instans ECS disambungkan sebagai disk data, tidak ada batasan pada metode penagihannya.

    • Setelah elastic ephemeral disk dilepas, disk tersebut hanya dapat disambungkan kembali ke instans aslinya.

  • Saat menyambungkan disk sistem:

    • Instance ECS target harus merupakan instans sumber tempat disk sistem dilepas.

    • Instance ECS target harus berada dalam status Stopped (Stopped).

    • Anda harus menetapkan kredensial logon untuk instans.

    • Elastic ephemeral disk tidak dapat disambungkan sebagai disk sistem.

    • Untuk informasi selengkapnya tentang menyambungkan disk sistem, lihat Melepas atau menyambungkan disk sistem.

  • Saat mengkueri informasi tentang Instans ECS, jika tanggapan mengandung {"OperationLocks": {"LockReason" : "security"}}, semua operasi pada instans tersebut dilarang.

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tabel berikut menjelaskan otorisasi yang diperlukan untuk memanggil API ini. Anda dapat menentukannya dalam kebijakan Resource Access Management (RAM). Kolom pada tabel dijelaskan sebagai berikut:

  • Action: Aksi yang dapat digunakan dalam elemen Action pada pernyataan kebijakan izin RAM untuk memberikan izin guna melakukan operasi tersebut.

  • API: API yang dapat Anda panggil untuk melakukan aksi tersebut.

  • Access level: Tingkat akses yang telah ditentukan untuk setiap API. Nilai yang valid: create, list, get, update, dan delete.

  • Resource type: Jenis resource yang mendukung otorisasi untuk melakukan aksi tersebut. Ini menunjukkan apakah aksi tersebut mendukung izin tingkat resource. Resource yang ditentukan harus kompatibel dengan aksi tersebut. Jika tidak, kebijakan tersebut tidak akan berlaku.

    • Untuk API dengan izin tingkat resource, jenis resource yang diperlukan ditandai dengan tanda bintang (*). Tentukan Nama Sumber Daya Alibaba Cloud (ARN) yang sesuai dalam elemen Resource pada kebijakan.

    • Untuk API tanpa izin tingkat resource, ditampilkan sebagai All Resources. Gunakan tanda bintang (*) dalam elemen Resource pada kebijakan.

  • Condition key: Kunci kondisi yang didefinisikan oleh layanan. Kunci ini memungkinkan kontrol granular, berlaku baik hanya untuk aksi maupun untuk aksi yang terkait dengan resource tertentu. Selain kunci kondisi spesifik layanan, Alibaba Cloud menyediakan serangkaian common condition keys yang berlaku di semua layanan yang didukung RAM.

  • Dependent action: Aksi dependen yang diperlukan untuk menjalankan aksi tersebut. Untuk menyelesaikan aksi tersebut, pengguna RAM atau role RAM harus memiliki izin untuk melakukan semua aksi dependen.

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

Parameter permintaan

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

ID Instans ECS tempat disk akan disambungkan.

i-bp1dq5lozx5f4pmd****

DiskId

string

Yes

ID disk yang akan disambungkan. Disk (DiskId) dan instans (InstanceId) harus berada di zona yang sama.

Catatan

Baik disk data maupun disk sistem dapat disambungkan. Untuk batasan terkait, lihat deskripsi API di atas.

d-bp1j4l5axzdy6ftk****

Device

string

No

Nama perangkat disk.

Catatan

Parameter ini akan dihentikan penggunaannya. Untuk meningkatkan kompatibilitas, kami menyarankan Anda menggunakan parameter lain untuk mengidentifikasi disk.

testDeviceName

DeleteWithInstance

boolean

No

Apakah akan merilis disk bersama instans saat instans dirilis. Nilai valid:

  • true: merilis disk bersama instans.

  • false: tidak merilis disk bersama instans. Disk akan dipertahankan dan dikonversi menjadi disk data pay-as-you-go.

Nilai default: false.

Saat menetapkan parameter ini, perhatikan hal-hal berikut:

  • Setelah Anda menetapkan DeleteWithInstance ke false, jika Instans ECS terkunci karena alasan keamanan (OperationLocks mengandung "LockReason" : "security"), atribut disk ini akan diabaikan dan disk akan dirilis bersama Instans ECS.

  • Jika disk target yang ingin Anda sambungkan adalah elastic ephemeral disk, Anda harus menetapkan parameter DeleteWithInstance ke true.

  • Parameter ini tidak dapat ditetapkan untuk disk yang memiliki fitur multi-attach diaktifkan.

false

Bootable

boolean

No

Apakah akan menyambungkan disk sebagai disk sistem. Nilai valid:

  • true: Ya.

  • false: Tidak.

Nilai default: false.

Catatan

Jika Anda menetapkan Bootable=true, Instans ECS target tidak boleh memiliki disk sistem.

false

Password

string

No

Saat menyambungkan disk sistem, tetapkan kata sandi untuk instans. Parameter ini hanya berlaku untuk nama pengguna administrator dan root; tidak berlaku untuk nama pengguna lain. Kata sandi harus memiliki panjang 8 hingga 30 karakter dan harus mengandung setidaknya tiga dari jenis karakter berikut: huruf besar, huruf kecil, angka, dan karakter khusus. Karakter khusus dapat berupa:

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

Untuk instans Windows, kata sandi tidak boleh diawali dengan garis miring (/).

Catatan

Jika parameter Password dikirimkan, kami menyarankan Anda mengirim permintaan melalui HTTPS untuk mencegah kebocoran kata sandi.

EcsV587!

KeyPairName

string

No

Saat menyambungkan disk sistem, nama pasangan kunci SSH yang akan diikat ke Instans ECS Linux.

  • Windows Server: Pasangan kunci SSH tidak didukung. Meskipun parameter ini ditentukan, hanya konfigurasi Password yang berlaku.

  • Linux: Logon berbasis kata sandi dinonaktifkan secara default.

KeyPairTestName

Force

boolean

No

Apakah akan menyambungkan disk secara paksa. Nilai valid:

  • true: Ya.

  • false: Tidak.

Nilai default: false.

Catatan

Saat ini, hanya ESSD tipe redundan wilayah (cloud_regional_disk_auto) yang mendukung pengaturan bidang ini ke true.

false

Elemen respons

Element

Type

Description

Example

object

RequestId

string

ID permintaan.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Contoh

Respons sukses

JSONformat

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

Respons error

JSONformat

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

Kode kesalahan

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, can not be attached as 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 some unknown error, exception or failure.
403 InstanceDiskLimitExceeded The amount of the disk on instance in question reach its limits.
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 as your disk owing fee.
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 needs to be added ECS tag.
403 InvalidParameter.KMSKeyId.KMSUnauthorized ECS service have no right to access your KMS.
403 DependencyViolation.WindowsInstance The instance image is windows, cannot use ssh key pair to login.
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's 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 KMS key used by the disk does not exist.

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.