一千萬個為什麽

搜索

通過Cloudformation模板暫停自動縮放過程



我具有以下自動縮放作為Cloudformation模板:

  MyAutoScalingGroup:
    Type: AWS::AutoScaling::AutoScalingGroup
    Properties:
      DesiredCapacity: 1
      MinSize: 1
      MaxSize: 1
      LaunchConfigurationName: !Ref MyLaunchConfiguration
      AvailabilityZones: !GetAZs

我正在努力定義暫停的進程在Cloudformation模板中。

嘗試一種直觀的方法(將其添加為屬性)並且完全不起作用:

  MyAutoScalingGroup:
    Type: AWS::AutoScaling::AutoScalingGroup
    Properties:
      DesiredCapacity: 1
      MinSize: 1
      MaxSize: 1
      LaunchConfigurationName: !Ref MyLaunchConfiguration
      AvailabilityZones: !GetAZs
      SuspendedProcesses:
        - AZRebalance
        - Terminate

轉載註明原文: 通過Cloudformation模板暫停自動縮放過程

一共有 1 個回答:

通過UpdatePolicy的官方文檔獲得。實際上,我們可以通過為 AWS :: AutoScaling :: AutoScalingGroup 資源使用 UpdatePolicy 屬性來掛起進程:

  • So instead of SuspendedProcesses, the right term is SuspendProcesses.

  • Also instead of putting SuspendProcesses under Properties, it should be under UpdatePolicy > AutoScalingRollingUpdate .

_

  MyAutoScalingGroup:
    Type: AWS::AutoScaling::AutoScalingGroup
    Properties:
      DesiredCapacity: 1
      MinSize: 1
      MaxSize: 1
      LaunchConfigurationName: !Ref MyLaunchConfiguration
      AvailabilityZones: !GetAZs
    UpdatePolicy:
      AutoScalingRollingUpdate:
        SuspendProcesses:
        - AZRebalance
        - Terminate