搭配使用 DeleteLifecycleHook 與 CLI - Amazon EC2 Auto Scaling

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

搭配使用 DeleteLifecycleHook 與 CLI

下列程式碼範例示範如何使用 DeleteLifecycleHook

CLI
AWS CLI

刪除 lifecycle hook

此範例會刪除指定的 lifecycle hook。

aws autoscaling delete-lifecycle-hook \ --lifecycle-hook-name my-lifecycle-hook \ --auto-scaling-group-name my-asg

此命令不會產生輸出。

PowerShell
Tools for PowerShell V4

範例 1:此範例刪除指定 Auto Scaling 群組的指定 lifecycle hook。在繼續操作之前,系統會提示您確認。

Remove-ASLifecycleHook -AutoScalingGroupName my-asg -LifecycleHookName myLifecycleHook

輸出:

Confirm Are you sure you want to perform this action? Performing operation "Remove-ASLifecycleHook (DeleteLifecycleHook)" on Target "myLifecycleHook". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):

範例 2:如果您指定強制參數,在繼續操作之前,系統不會提示您進行確認。

Remove-ASLifecycleHook -AutoScalingGroupName my-asg -LifecycleHookName myLifecycleHook -Force
  • 如需 API 詳細資訊,請參閱《AWS Tools for PowerShell Cmdlet 參考 (V4)》中的 DeleteLifecycleHook

Tools for PowerShell V5

範例 1:此範例刪除指定 Auto Scaling 群組的指定 lifecycle hook。在繼續操作之前,系統會提示您確認。

Remove-ASLifecycleHook -AutoScalingGroupName my-asg -LifecycleHookName myLifecycleHook

輸出:

Confirm Are you sure you want to perform this action? Performing operation "Remove-ASLifecycleHook (DeleteLifecycleHook)" on Target "myLifecycleHook". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):

範例 2:如果您指定強制參數,在繼續操作之前,系統不會提示您進行確認。

Remove-ASLifecycleHook -AutoScalingGroupName my-asg -LifecycleHookName myLifecycleHook -Force
  • 如需 API 詳細資訊,請參閱《AWS Tools for PowerShell Cmdlet 參考 (V5)》中的 DeleteLifecycleHook

如需 AWS SDK 開發人員指南和程式碼範例的完整清單,請參閱 搭配 AWS SDK 使用此服務。此主題也包含有關入門的資訊和舊版 SDK 的詳細資訊。