搭配使用 SuspendProcesses 與 CLI - AWS SDK 程式碼範例

AWS文件開發套件範例 GitHub 儲存庫中有更多可用的 AWS SDK 範例。

搭配使用 SuspendProcesses 與 CLI

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

CLI
AWS CLI

暫停 Auto Scaling 處理程序

此範例暫停指定的 Auto Scaling 群組的指定擴展程序。

aws autoscaling suspend-processes \ --auto-scaling-group-name my-asg \ --scaling-processes AlarmNotification

此命令不會產生輸出。

如需詳細資訊,請參閱《Amazon EC2 Auto Scaling 使用者指南》中的暫停及繼續擴展程序

  • 如需 API 詳細資訊,請參閱《AWS CLI 命令參考》中的 SuspendProcesses

PowerShell
Tools for PowerShell V4

範例 1:此範例暫停指定的 Auto Scaling 群組的指定 Auto Scaling 處理程序。

Suspend-ASProcess -AutoScalingGroupName my-asg -ScalingProcess "AlarmNotification"

範例 2:此範例暫停指定的 Auto Scaling 群組的所有 Auto Scaling 處理程序。

Suspend-ASProcess -AutoScalingGroupName my-asg
  • 如需 API 詳細資訊,請參閱《AWS Tools for PowerShell Cmdlet 參考 (V4)》中的 SuspendProcesses

Tools for PowerShell V5

範例 1:此範例暫停指定的 Auto Scaling 群組的指定 Auto Scaling 處理程序。

Suspend-ASProcess -AutoScalingGroupName my-asg -ScalingProcess "AlarmNotification"

範例 2:此範例暫停指定的 Auto Scaling 群組的所有 Auto Scaling 處理程序。

Suspend-ASProcess -AutoScalingGroupName my-asg
  • 如需 API 詳細資訊,請參閱《AWS Tools for PowerShell Cmdlet 參考 (V5)》中的 SuspendProcesses