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 ReleaseHosts
dengan CLI
Contoh kode berikut menunjukkan cara menggunakanReleaseHosts
.
- CLI
-
- AWS CLI
-
Untuk melepaskan host Khusus dari akun Anda
Untuk melepaskan host Khusus dari akun Anda. Instance yang ada di host harus dihentikan atau dihentikan sebelum host dapat dirilis.
Perintah:
aws ec2 release-hosts --host-id=h-0029d6e3cacf1b3da
Output:
{ "Successful": [ "h-0029d6e3cacf1b3da" ], "Unsuccessful": [] }
-
Untuk detail API, lihat ReleaseHosts
di Referensi AWS CLI Perintah.
-
- PowerShell
-
- Alat untuk PowerShell V4
-
Contoh 1: Contoh ini merilis ID host yang diberikan h-0badafd1dcb2f3456
Remove-EC2Host -HostId h-0badafd1dcb2f3456
Output:
Confirm Are you sure you want to perform this action? Performing the operation "Remove-EC2Host (ReleaseHosts)" on target "h-0badafd1dcb2f3456". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y Successful Unsuccessful ---------- ------------ {h-0badafd1dcb2f3456} {}
-
Untuk detail API, lihat ReleaseHostsdi Referensi Alat AWS untuk PowerShell Cmdlet (V4).
-
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini merilis ID host yang diberikan h-0badafd1dcb2f3456
Remove-EC2Host -HostId h-0badafd1dcb2f3456
Output:
Confirm Are you sure you want to perform this action? Performing the operation "Remove-EC2Host (ReleaseHosts)" on target "h-0badafd1dcb2f3456". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y Successful Unsuccessful ---------- ------------ {h-0badafd1dcb2f3456} {}
-
Untuk detail API, lihat ReleaseHostsdi Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-