Ada lebih banyak contoh AWS SDK yang tersedia di repo Contoh SDK AWS Doc
Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Gunakan DeleteVolume
dengan CLI
Contoh kode berikut menunjukkan cara menggunakanDeleteVolume
.
- CLI
-
- AWS CLI
-
Untuk menghapus volume
Perintah contoh ini menghapus volume yang tersedia dengan ID volume dari.
vol-049df61146c4d7901
Jika perintah berhasil, tidak ada output yang akan ditampilkan.Perintah:
aws ec2 delete-volume --volume-id
vol-049df61146c4d7901
-
Untuk detail API, lihat DeleteVolume
di Referensi AWS CLI Perintah.
-
- PowerShell
-
- Alat untuk PowerShell V4
-
Contoh 1: Contoh ini melepaskan volume yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.
Remove-EC2Volume -VolumeId vol-12345678
Output:
Confirm Are you sure you want to perform this action? Performing the operation "Remove-EC2Volume (DeleteVolume)" on target "vol-12345678". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
-
Untuk detail API, lihat DeleteVolumedi Referensi Alat AWS untuk PowerShell Cmdlet (V4).
-
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini melepaskan volume yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.
Remove-EC2Volume -VolumeId vol-12345678
Output:
Confirm Are you sure you want to perform this action? Performing the operation "Remove-EC2Volume (DeleteVolume)" on target "vol-12345678". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
-
Untuk detail API, lihat DeleteVolumedi Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-