AWS 文档 SDK 示例
将 DeleteLifecycleHook 与 CLI 配合使用
以下代码示例演示如何使用 DeleteLifecycleHook。
- CLI
-
- AWS CLI
-
删除生命周期挂钩
此示例删除指定的生命周期挂钩。
aws autoscaling delete-lifecycle-hook \ --lifecycle-hook-namemy-lifecycle-hook\ --auto-scaling-group-namemy-asg此命令不生成任何输出。
-
有关 API 详细信息,请参阅《AWS CLI 命令参考》中的 DeleteLifecycleHook
。
-
- PowerShell
-
- Tools for PowerShell V4
-
示例 1:此示例删除指定自动扩缩组的指定生命周期挂钩。在操作继续之前,系统会提示您进行确认。
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:如果您指定 Force 参数,则在操作继续之前,系统不会提示您进行确认。
Remove-ASLifecycleHook -AutoScalingGroupName my-asg -LifecycleHookName myLifecycleHook -Force-
有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference (V4)》中的 DeleteLifecycleHook。
-
- Tools for PowerShell V5
-
示例 1:此示例删除指定自动扩缩组的指定生命周期挂钩。在操作继续之前,系统会提示您进行确认。
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:如果您指定 Force 参数,则在操作继续之前,系统不会提示您进行确认。
Remove-ASLifecycleHook -AutoScalingGroupName my-asg -LifecycleHookName myLifecycleHook -Force-
有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference (V5)》中的 DeleteLifecycleHook。
-
DeleteLaunchConfiguration
DeleteNotificationConfiguration