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 DeletePolicy
dengan CLI
Contoh kode berikut menunjukkan cara menggunakanDeletePolicy
.
- CLI
-
- AWS CLI
-
Untuk menghapus kebijakan penskalaan
Contoh ini menghapus kebijakan penskalaan yang ditentukan.
aws autoscaling delete-policy \ --auto-scaling-group-name
my-asg
\ --policy-namealb1000-target-tracking-scaling-policy
Perintah ini tidak menghasilkan output.
-
Untuk detail API, lihat DeletePolicy
di Referensi AWS CLI Perintah.
-
- PowerShell
-
- Alat untuk PowerShell V4
-
Contoh 1: Contoh ini menghapus kebijakan yang ditentukan untuk grup Auto Scaling yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung.
Remove-ASPolicy -AutoScalingGroupName my-asg -PolicyName myScaleInPolicy
Output:
Confirm Are you sure you want to perform this action? Performing operation "Remove-ASPolicy (DeletePolicy)" on Target "myScaleInPolicy". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
Contoh 2: Jika Anda menentukan parameter Force, Anda tidak diminta untuk konfirmasi sebelum operasi berlangsung.
Remove-ASPolicy -AutoScalingGroupName my-asg -PolicyName myScaleInPolicy -Force
-
Untuk detail API, lihat DeletePolicydi Referensi Alat AWS untuk PowerShell Cmdlet (V4).
-
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menghapus kebijakan yang ditentukan untuk grup Auto Scaling yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung.
Remove-ASPolicy -AutoScalingGroupName my-asg -PolicyName myScaleInPolicy
Output:
Confirm Are you sure you want to perform this action? Performing operation "Remove-ASPolicy (DeletePolicy)" on Target "myScaleInPolicy". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
Contoh 2: Jika Anda menentukan parameter Force, Anda tidak diminta untuk konfirmasi sebelum operasi berlangsung.
Remove-ASPolicy -AutoScalingGroupName my-asg -PolicyName myScaleInPolicy -Force
-
Untuk detail API, lihat DeletePolicydi Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-