Class: AWSCDK::CfnAutoScalingRollingUpdate

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cfn_auto_scaling_rolling_update.rb

Overview

To specify how AWS CloudFormation handles rolling updates for an Auto Scaling group, use the AutoScalingRollingUpdate policy.

Rolling updates enable you to specify whether AWS CloudFormation updates instances that are in an Auto Scaling group in batches or all at once.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(max_batch_size: nil, min_active_instances_percent: nil, min_instances_in_service: nil, min_successful_instances_percent: nil, pause_time: nil, suspend_processes: nil, wait_on_resource_signals: nil) ⇒ CfnAutoScalingRollingUpdate

Returns a new instance of CfnAutoScalingRollingUpdate.

Parameters:

  • max_batch_size (Numeric, nil) (defaults to: nil)

    Specifies the maximum number of instances that AWS CloudFormation updates.

  • min_active_instances_percent (Numeric, nil) (defaults to: nil)

    Specifies the percentage of instances in an Auto Scaling group that must remain in service while AWS CloudFormation updates old instances.

  • min_instances_in_service (Numeric, nil) (defaults to: nil)

    Specifies the minimum number of instances that must be in service within the Auto Scaling group while AWS CloudFormation updates old instances.

  • min_successful_instances_percent (Numeric, nil) (defaults to: nil)

    Specifies the percentage of instances in an Auto Scaling rolling update that must signal success for an update to succeed.

  • pause_time (String, nil) (defaults to: nil)

    The amount of time that AWS CloudFormation pauses after making a change to a batch of instances to give those instances time to start software applications.

  • suspend_processes (Array<String>, nil) (defaults to: nil)

    Specifies the Auto Scaling processes to suspend during a stack update.

  • wait_on_resource_signals (Boolean, nil) (defaults to: nil)

    Specifies whether the Auto Scaling group waits on signals from new instances during an update.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'cfn_auto_scaling_rolling_update.rb', line 17

def initialize(max_batch_size: nil, min_active_instances_percent: nil, min_instances_in_service: nil, min_successful_instances_percent: nil, pause_time: nil, suspend_processes: nil, wait_on_resource_signals: nil)
  @max_batch_size = max_batch_size
  Jsii::Type.check_type(@max_batch_size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxBatchSize") unless @max_batch_size.nil?
  @min_active_instances_percent = min_active_instances_percent
  Jsii::Type.check_type(@min_active_instances_percent, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minActiveInstancesPercent") unless @min_active_instances_percent.nil?
  @min_instances_in_service = min_instances_in_service
  Jsii::Type.check_type(@min_instances_in_service, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minInstancesInService") unless @min_instances_in_service.nil?
  @min_successful_instances_percent = min_successful_instances_percent
  Jsii::Type.check_type(@min_successful_instances_percent, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minSuccessfulInstancesPercent") unless @min_successful_instances_percent.nil?
  @pause_time = pause_time
  Jsii::Type.check_type(@pause_time, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "pauseTime") unless @pause_time.nil?
  @suspend_processes = suspend_processes
  Jsii::Type.check_type(@suspend_processes, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "suspendProcesses") unless @suspend_processes.nil?
  @wait_on_resource_signals = wait_on_resource_signals
  Jsii::Type.check_type(@wait_on_resource_signals, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "waitOnResourceSignals") unless @wait_on_resource_signals.nil?
end

Instance Attribute Details

#max_batch_sizeNumeric? (readonly)

Specifies the maximum number of instances that AWS CloudFormation updates.

Returns:

  • (Numeric, nil)


37
38
39
# File 'cfn_auto_scaling_rolling_update.rb', line 37

def max_batch_size
  @max_batch_size
end

#min_active_instances_percentNumeric? (readonly)

Specifies the percentage of instances in an Auto Scaling group that must remain in service while AWS CloudFormation updates old instances.

You can specify a value from 0 to 100. AWS CloudFormation rounds to the nearest tenth of a percent. For example, if you update five instances with a minimum active percentage of 50, three instances must remain in service.

Returns:

  • (Numeric, nil)


44
45
46
# File 'cfn_auto_scaling_rolling_update.rb', line 44

def min_active_instances_percent
  @min_active_instances_percent
end

#min_instances_in_serviceNumeric? (readonly)

Specifies the minimum number of instances that must be in service within the Auto Scaling group while AWS CloudFormation updates old instances.

Returns:

  • (Numeric, nil)


48
49
50
# File 'cfn_auto_scaling_rolling_update.rb', line 48

def min_instances_in_service
  @min_instances_in_service
end

#min_successful_instances_percentNumeric? (readonly)

Specifies the percentage of instances in an Auto Scaling rolling update that must signal success for an update to succeed.

You can specify a value from 0 to 100. AWS CloudFormation rounds to the nearest tenth of a percent. For example, if you update five instances with a minimum successful percentage of 50, three instances must signal success.

If an instance doesn't send a signal within the time specified in the PauseTime property, AWS CloudFormation assumes that the instance wasn't updated.

If you specify this property, you must also enable the WaitOnResourceSignals and PauseTime properties.

Returns:

  • (Numeric, nil)


60
61
62
# File 'cfn_auto_scaling_rolling_update.rb', line 60

def min_successful_instances_percent
  @min_successful_instances_percent
end

#pause_timeString? (readonly)

The amount of time that AWS CloudFormation pauses after making a change to a batch of instances to give those instances time to start software applications.

For example, you might need to specify PauseTime when scaling up the number of instances in an Auto Scaling group.

If you enable the WaitOnResourceSignals property, PauseTime is the amount of time that AWS CloudFormation should wait for the Auto Scaling group to receive the required number of valid signals from added or replaced instances. If the PauseTime is exceeded before the Auto Scaling group receives the required number of signals, the update fails. For best results, specify a time period that gives your applications sufficient time to get started. If the update needs to be rolled back, a short PauseTime can cause the rollback to fail.

Specify PauseTime in the ISO8601 duration format (in the format PT#H#M#S, where each # is the number of hours, minutes, and seconds, respectively). The maximum PauseTime is one hour (PT1H).

Returns:

  • (String, nil)


76
77
78
# File 'cfn_auto_scaling_rolling_update.rb', line 76

def pause_time
  @pause_time
end

#suspend_processesArray<String>? (readonly)

Specifies the Auto Scaling processes to suspend during a stack update.

Suspending processes prevents Auto Scaling from interfering with a stack update. For example, you can suspend alarming so that Auto Scaling doesn't execute scaling policies associated with an alarm. For valid values, see the ScalingProcesses.member.N parameter for the SuspendProcesses action in the Auto Scaling API Reference.

Returns:

  • (Array<String>, nil)


85
86
87
# File 'cfn_auto_scaling_rolling_update.rb', line 85

def suspend_processes
  @suspend_processes
end

#wait_on_resource_signalsBoolean? (readonly)

Specifies whether the Auto Scaling group waits on signals from new instances during an update.

Use this property to ensure that instances have completed installing and configuring applications before the Auto Scaling group update proceeds. AWS CloudFormation suspends the update of an Auto Scaling group after new EC2 instances are launched into the group. AWS CloudFormation must receive a signal from each new instance within the specified PauseTime before continuing the update. To signal the Auto Scaling group, use the cfn-signal helper script or SignalResource API.

To have instances wait for an Elastic Load Balancing health check before they signal success, add a health-check verification by using the cfn-init helper script. For an example, see the verify_instance_health command in the Auto Scaling rolling updates sample template.

Returns:

  • (Boolean, nil)


99
100
101
# File 'cfn_auto_scaling_rolling_update.rb', line 99

def wait_on_resource_signals
  @wait_on_resource_signals
end

Class Method Details

.jsii_propertiesObject



101
102
103
104
105
106
107
108
109
110
111
# File 'cfn_auto_scaling_rolling_update.rb', line 101

def self.jsii_properties
  {
    :max_batch_size => "maxBatchSize",
    :min_active_instances_percent => "minActiveInstancesPercent",
    :min_instances_in_service => "minInstancesInService",
    :min_successful_instances_percent => "minSuccessfulInstancesPercent",
    :pause_time => "pauseTime",
    :suspend_processes => "suspendProcesses",
    :wait_on_resource_signals => "waitOnResourceSignals",
  }
end

Instance Method Details

#to_jsiiObject



113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'cfn_auto_scaling_rolling_update.rb', line 113

def to_jsii
  result = {}
  result.merge!({
    "maxBatchSize" => @max_batch_size,
    "minActiveInstancesPercent" => @min_active_instances_percent,
    "minInstancesInService" => @min_instances_in_service,
    "minSuccessfulInstancesPercent" => @min_successful_instances_percent,
    "pauseTime" => @pause_time,
    "suspendProcesses" => @suspend_processes,
    "waitOnResourceSignals" => @wait_on_resource_signals,
  })
  result.compact
end