Class: AWSCDK::Autoscaling::CfnScalingPolicyProps

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

Overview

Properties for defining a CfnScalingPolicy.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auto_scaling_group_name:, adjustment_type: nil, cooldown: nil, estimated_instance_warmup: nil, metric_aggregation_type: nil, min_adjustment_magnitude: nil, policy_type: nil, predictive_scaling_configuration: nil, scaling_adjustment: nil, step_adjustments: nil, target_tracking_configuration: nil) ⇒ CfnScalingPolicyProps

Returns a new instance of CfnScalingPolicyProps.

Parameters:

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

    The name of the Auto Scaling group.

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

    Specifies how the scaling adjustment is interpreted (for example, an absolute number or a percentage).

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

    A cooldown period, in seconds, that applies to a specific simple scaling policy.

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

    Not needed if the default instance warmup is defined for the group..

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

    The aggregation type for the CloudWatch metrics.

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

    The minimum value to scale by when the adjustment type is PercentChangeInCapacity .

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

    One of the following policy types:.

  • predictive_scaling_configuration (AWSCDK::IResolvable, AWSCDK::Autoscaling::CfnScalingPolicy::PredictiveScalingConfigurationProperty, nil) (defaults to: nil)

    A predictive scaling policy. Provides support for predefined and custom metrics.

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

    The amount by which to scale, based on the specified adjustment type.

  • step_adjustments (AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::Autoscaling::CfnScalingPolicy::StepAdjustmentProperty>, nil) (defaults to: nil)

    A set of adjustments that enable you to scale based on the size of the alarm breach.

  • target_tracking_configuration (AWSCDK::IResolvable, AWSCDK::Autoscaling::CfnScalingPolicy::TargetTrackingConfigurationProperty, nil) (defaults to: nil)

    A target tracking scaling policy. Provides support for predefined or custom metrics.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'autoscaling/cfn_scaling_policy_props.rb', line 20

def initialize(auto_scaling_group_name:, adjustment_type: nil, cooldown: nil, estimated_instance_warmup: nil, metric_aggregation_type: nil, min_adjustment_magnitude: nil, policy_type: nil, predictive_scaling_configuration: nil, scaling_adjustment: nil, step_adjustments: nil, target_tracking_configuration: nil)
  @auto_scaling_group_name = auto_scaling_group_name
  Jsii::Type.check_type(@auto_scaling_group_name, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoic3RyaW5nIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19hdXRvc2NhbGluZy5JQXV0b1NjYWxpbmdHcm91cFJlZiJ9XX19")), "autoScalingGroupName")
  @adjustment_type = adjustment_type
  Jsii::Type.check_type(@adjustment_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "adjustmentType") unless @adjustment_type.nil?
  @cooldown = cooldown
  Jsii::Type.check_type(@cooldown, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "cooldown") unless @cooldown.nil?
  @estimated_instance_warmup = estimated_instance_warmup
  Jsii::Type.check_type(@estimated_instance_warmup, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "estimatedInstanceWarmup") unless @estimated_instance_warmup.nil?
  @metric_aggregation_type = metric_aggregation_type
  Jsii::Type.check_type(@metric_aggregation_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricAggregationType") unless @metric_aggregation_type.nil?
  @min_adjustment_magnitude = min_adjustment_magnitude
  Jsii::Type.check_type(@min_adjustment_magnitude, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minAdjustmentMagnitude") unless @min_adjustment_magnitude.nil?
  @policy_type = policy_type
  Jsii::Type.check_type(@policy_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "policyType") unless @policy_type.nil?
  @predictive_scaling_configuration = predictive_scaling_configuration.is_a?(Hash) ? ::AWSCDK::Autoscaling::CfnScalingPolicy::PredictiveScalingConfigurationProperty.new(**predictive_scaling_configuration.transform_keys(&:to_sym)) : predictive_scaling_configuration
  Jsii::Type.check_type(@predictive_scaling_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hdXRvc2NhbGluZy5DZm5TY2FsaW5nUG9saWN5LlByZWRpY3RpdmVTY2FsaW5nQ29uZmlndXJhdGlvblByb3BlcnR5In1dfX0=")), "predictiveScalingConfiguration") unless @predictive_scaling_configuration.nil?
  @scaling_adjustment = scaling_adjustment
  Jsii::Type.check_type(@scaling_adjustment, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "scalingAdjustment") unless @scaling_adjustment.nil?
  @step_adjustments = step_adjustments
  Jsii::Type.check_type(@step_adjustments, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuQ2ZuU2NhbGluZ1BvbGljeS5TdGVwQWRqdXN0bWVudFByb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "stepAdjustments") unless @step_adjustments.nil?
  @target_tracking_configuration = target_tracking_configuration.is_a?(Hash) ? ::AWSCDK::Autoscaling::CfnScalingPolicy::TargetTrackingConfigurationProperty.new(**target_tracking_configuration.transform_keys(&:to_sym)) : target_tracking_configuration
  Jsii::Type.check_type(@target_tracking_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hdXRvc2NhbGluZy5DZm5TY2FsaW5nUG9saWN5LlRhcmdldFRyYWNraW5nQ29uZmlndXJhdGlvblByb3BlcnR5In1dfX0=")), "targetTrackingConfiguration") unless @target_tracking_configuration.nil?
end

Instance Attribute Details

#adjustment_typeString? (readonly)

Specifies how the scaling adjustment is interpreted (for example, an absolute number or a percentage).

The valid values are ChangeInCapacity , ExactCapacity , and PercentChangeInCapacity .

Required if the policy type is StepScaling or SimpleScaling . For more information, see Scaling adjustment types in the Amazon EC2 Auto Scaling User Guide .



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

def adjustment_type
  @adjustment_type
end

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

The name of the Auto Scaling group.



49
50
51
# File 'autoscaling/cfn_scaling_policy_props.rb', line 49

def auto_scaling_group_name
  @auto_scaling_group_name
end

#cooldownString? (readonly)

A cooldown period, in seconds, that applies to a specific simple scaling policy.

When a cooldown period is specified here, it overrides the default cooldown.

Valid only if the policy type is SimpleScaling . For more information, see Scaling cooldowns for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide .

Default: None



69
70
71
# File 'autoscaling/cfn_scaling_policy_props.rb', line 69

def cooldown
  @cooldown
end

#estimated_instance_warmupNumeric? (readonly)

Not needed if the default instance warmup is defined for the group..

The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. This warm-up period applies to instances launched due to a specific target tracking or step scaling policy. When a warm-up period is specified here, it overrides the default instance warmup.

Valid only if the policy type is TargetTrackingScaling or StepScaling .

The default is to use the value for the default instance warmup defined for the group. If default instance warmup is null, then EstimatedInstanceWarmup falls back to the value of default cooldown.



80
81
82
# File 'autoscaling/cfn_scaling_policy_props.rb', line 80

def estimated_instance_warmup
  @estimated_instance_warmup
end

#metric_aggregation_typeString? (readonly)

The aggregation type for the CloudWatch metrics.

The valid values are Minimum , Maximum , and Average . If the aggregation type is null, the value is treated as Average .

Valid only if the policy type is StepScaling .



89
90
91
# File 'autoscaling/cfn_scaling_policy_props.rb', line 89

def metric_aggregation_type
  @metric_aggregation_type
end

#min_adjustment_magnitudeNumeric? (readonly)

The minimum value to scale by when the adjustment type is PercentChangeInCapacity .

For example, suppose that you create a step scaling policy to scale out an Auto Scaling group by 25 percent and you specify a MinAdjustmentMagnitude of 2. If the group has 4 instances and the scaling policy is performed, 25 percent of 4 is 1. However, because you specified a MinAdjustmentMagnitude of 2, Amazon EC2 Auto Scaling scales out the group by 2 instances.

Valid only if the policy type is StepScaling or SimpleScaling . For more information, see Scaling adjustment types in the Amazon EC2 Auto Scaling User Guide .

Some Auto Scaling groups use instance weights. In this case, set the MinAdjustmentMagnitude to a value that is at least as large as your largest instance weight.



100
101
102
# File 'autoscaling/cfn_scaling_policy_props.rb', line 100

def min_adjustment_magnitude
  @min_adjustment_magnitude
end

#policy_typeString? (readonly)

One of the following policy types:.

  • TargetTrackingScaling
  • StepScaling
  • SimpleScaling (default)
  • PredictiveScaling


110
111
112
# File 'autoscaling/cfn_scaling_policy_props.rb', line 110

def policy_type
  @policy_type
end

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

A predictive scaling policy. Provides support for predefined and custom metrics.

Predefined metrics include CPU utilization, network in/out, and the Application Load Balancer request count.

Required if the policy type is PredictiveScaling .



119
120
121
# File 'autoscaling/cfn_scaling_policy_props.rb', line 119

def predictive_scaling_configuration
  @predictive_scaling_configuration
end

#scaling_adjustmentNumeric? (readonly)

The amount by which to scale, based on the specified adjustment type.

A positive value adds to the current capacity while a negative number removes from the current capacity. For exact capacity, you must specify a non-negative value.

Required if the policy type is SimpleScaling . (Not used with any other policy type.)



128
129
130
# File 'autoscaling/cfn_scaling_policy_props.rb', line 128

def scaling_adjustment
  @scaling_adjustment
end

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

A set of adjustments that enable you to scale based on the size of the alarm breach.

Required if the policy type is StepScaling . (Not used with any other policy type.)



135
136
137
# File 'autoscaling/cfn_scaling_policy_props.rb', line 135

def step_adjustments
  @step_adjustments
end

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

A target tracking scaling policy. Provides support for predefined or custom metrics.

The following predefined metrics are available:

  • ASGAverageCPUUtilization
  • ASGAverageNetworkIn
  • ASGAverageNetworkOut
  • ALBRequestCountPerTarget

If you specify ALBRequestCountPerTarget for the metric, you must specify the ResourceLabel property with the PredefinedMetricSpecification .

Required if the policy type is TargetTrackingScaling .



151
152
153
# File 'autoscaling/cfn_scaling_policy_props.rb', line 151

def target_tracking_configuration
  @target_tracking_configuration
end

Class Method Details

.jsii_propertiesObject



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'autoscaling/cfn_scaling_policy_props.rb', line 153

def self.jsii_properties
  {
    :auto_scaling_group_name => "autoScalingGroupName",
    :adjustment_type => "adjustmentType",
    :cooldown => "cooldown",
    :estimated_instance_warmup => "estimatedInstanceWarmup",
    :metric_aggregation_type => "metricAggregationType",
    :min_adjustment_magnitude => "minAdjustmentMagnitude",
    :policy_type => "policyType",
    :predictive_scaling_configuration => "predictiveScalingConfiguration",
    :scaling_adjustment => "scalingAdjustment",
    :step_adjustments => "stepAdjustments",
    :target_tracking_configuration => "targetTrackingConfiguration",
  }
end

Instance Method Details

#to_jsiiObject



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'autoscaling/cfn_scaling_policy_props.rb', line 169

def to_jsii
  result = {}
  result.merge!({
    "autoScalingGroupName" => @auto_scaling_group_name,
    "adjustmentType" => @adjustment_type,
    "cooldown" => @cooldown,
    "estimatedInstanceWarmup" => @estimated_instance_warmup,
    "metricAggregationType" => @metric_aggregation_type,
    "minAdjustmentMagnitude" => @min_adjustment_magnitude,
    "policyType" => @policy_type,
    "predictiveScalingConfiguration" => @predictive_scaling_configuration,
    "scalingAdjustment" => @scaling_adjustment,
    "stepAdjustments" => @step_adjustments,
    "targetTrackingConfiguration" => @target_tracking_configuration,
  })
  result.compact
end