Class: AWSCDK::Autoscaling::CfnWarmPoolProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
autoscaling/cfn_warm_pool_props.rb

Overview

Properties for defining a CfnWarmPool.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auto_scaling_group_name:, instance_reuse_policy: nil, max_group_prepared_capacity: nil, min_size: nil, pool_state: nil) ⇒ CfnWarmPoolProps

Returns a new instance of CfnWarmPoolProps.

Parameters:

  • auto_scaling_group_name (String, AWSCDK::Interfaces::AWSAutoscaling::IAutoScalingGroupRef)

    The name of the Auto Scaling group.

  • instance_reuse_policy (AWSCDK::IResolvable, AWSCDK::Autoscaling::CfnWarmPool::InstanceReusePolicyProperty, nil) (defaults to: nil)

    Indicates whether instances in the Auto Scaling group can be returned to the warm pool on scale in.

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

    Specifies the maximum number of instances that are allowed to be in the warm pool or in any state except Terminated for the Auto Scaling group.

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

    Specifies the minimum number of instances to maintain in the warm pool.

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

    Sets the instance state to transition to after the lifecycle actions are complete.



14
15
16
17
18
19
20
21
22
23
24
25
# File 'autoscaling/cfn_warm_pool_props.rb', line 14

def initialize(auto_scaling_group_name:, instance_reuse_policy: nil, max_group_prepared_capacity: nil, min_size: nil, pool_state: nil)
  @auto_scaling_group_name = auto_scaling_group_name
  Jsii::Type.check_type(@auto_scaling_group_name, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoic3RyaW5nIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19hdXRvc2NhbGluZy5JQXV0b1NjYWxpbmdHcm91cFJlZiJ9XX19")), "autoScalingGroupName")
  @instance_reuse_policy = instance_reuse_policy.is_a?(Hash) ? ::AWSCDK::Autoscaling::CfnWarmPool::InstanceReusePolicyProperty.new(**instance_reuse_policy.transform_keys(&:to_sym)) : instance_reuse_policy
  Jsii::Type.check_type(@instance_reuse_policy, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hdXRvc2NhbGluZy5DZm5XYXJtUG9vbC5JbnN0YW5jZVJldXNlUG9saWN5UHJvcGVydHkifV19fQ==")), "instanceReusePolicy") unless @instance_reuse_policy.nil?
  @max_group_prepared_capacity = max_group_prepared_capacity
  Jsii::Type.check_type(@max_group_prepared_capacity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxGroupPreparedCapacity") unless @max_group_prepared_capacity.nil?
  @min_size = min_size
  Jsii::Type.check_type(@min_size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minSize") unless @min_size.nil?
  @pool_state = pool_state
  Jsii::Type.check_type(@pool_state, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "poolState") unless @pool_state.nil?
end

Instance Attribute Details

#auto_scaling_group_nameString, AWSCDK::Interfaces::AWSAutoscaling::IAutoScalingGroupRef (readonly)

The name of the Auto Scaling group.



31
32
33
# File 'autoscaling/cfn_warm_pool_props.rb', line 31

def auto_scaling_group_name
  @auto_scaling_group_name
end

#instance_reuse_policyAWSCDK::IResolvable, ... (readonly)

Indicates whether instances in the Auto Scaling group can be returned to the warm pool on scale in.

The default is to terminate instances in the Auto Scaling group when the group scales in.



38
39
40
# File 'autoscaling/cfn_warm_pool_props.rb', line 38

def instance_reuse_policy
  @instance_reuse_policy
end

#max_group_prepared_capacityNumeric? (readonly)

Specifies the maximum number of instances that are allowed to be in the warm pool or in any state except Terminated for the Auto Scaling group.

This is an optional property. Specify it only if you do not want the warm pool size to be determined by the difference between the group's maximum capacity and its desired capacity.

If a value for MaxGroupPreparedCapacity is not specified, Amazon EC2 Auto Scaling launches and maintains the difference between the group's maximum capacity and its desired capacity. If you specify a value for MaxGroupPreparedCapacity , Amazon EC2 Auto Scaling uses the difference between the MaxGroupPreparedCapacity and the desired capacity instead.

The size of the warm pool is dynamic. Only when MaxGroupPreparedCapacity and MinSize are set to the same value does the warm pool have an absolute size.

If the desired capacity of the Auto Scaling group is higher than the MaxGroupPreparedCapacity , the capacity of the warm pool is 0, unless you specify a value for MinSize . To remove a value that you previously set, include the property but specify -1 for the value.



51
52
53
# File 'autoscaling/cfn_warm_pool_props.rb', line 51

def max_group_prepared_capacity
  @max_group_prepared_capacity
end

#min_sizeNumeric? (readonly)

Specifies the minimum number of instances to maintain in the warm pool.

This helps you to ensure that there is always a certain number of warmed instances available to handle traffic spikes. Defaults to 0 if not specified.



58
59
60
# File 'autoscaling/cfn_warm_pool_props.rb', line 58

def min_size
  @min_size
end

#pool_stateString? (readonly)

Sets the instance state to transition to after the lifecycle actions are complete.

Default is Stopped .



65
66
67
# File 'autoscaling/cfn_warm_pool_props.rb', line 65

def pool_state
  @pool_state
end

Class Method Details

.jsii_propertiesObject



67
68
69
70
71
72
73
74
75
# File 'autoscaling/cfn_warm_pool_props.rb', line 67

def self.jsii_properties
  {
    :auto_scaling_group_name => "autoScalingGroupName",
    :instance_reuse_policy => "instanceReusePolicy",
    :max_group_prepared_capacity => "maxGroupPreparedCapacity",
    :min_size => "minSize",
    :pool_state => "poolState",
  }
end

Instance Method Details

#to_jsiiObject



77
78
79
80
81
82
83
84
85
86
87
# File 'autoscaling/cfn_warm_pool_props.rb', line 77

def to_jsii
  result = {}
  result.merge!({
    "autoScalingGroupName" => @auto_scaling_group_name,
    "instanceReusePolicy" => @instance_reuse_policy,
    "maxGroupPreparedCapacity" => @max_group_prepared_capacity,
    "minSize" => @min_size,
    "poolState" => @pool_state,
  })
  result.compact
end