Class: AWSCDK::Autoscaling::BasicStepScalingPolicyProps

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

Direct Known Subclasses

StepScalingPolicyProps

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metric:, scaling_steps:, adjustment_type: nil, cooldown: nil, datapoints_to_alarm: nil, estimated_instance_warmup: nil, evaluation_periods: nil, metric_aggregation_type: nil, min_adjustment_magnitude: nil) ⇒ BasicStepScalingPolicyProps

Returns a new instance of BasicStepScalingPolicyProps.

Parameters:

  • metric (AWSCDK::CloudWatch::IMetric)

    Metric to scale on.

  • scaling_steps (Array<AWSCDK::Autoscaling::ScalingInterval>)

    The intervals for scaling.

  • adjustment_type (AWSCDK::Autoscaling::AdjustmentType, nil) (defaults to: nil)

    How the adjustment numbers inside 'intervals' are interpreted.

  • cooldown (AWSCDK::Duration, nil) (defaults to: nil)

    Grace period after scaling activity.

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

    The number of data points out of the evaluation periods that must be breaching to trigger a scaling action.

  • estimated_instance_warmup (AWSCDK::Duration, nil) (defaults to: nil)

    Estimated time until a newly launched instance can send metrics to CloudWatch.

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

    How many evaluation periods of the metric to wait before triggering a scaling action.

  • metric_aggregation_type (AWSCDK::Autoscaling::MetricAggregationType, nil) (defaults to: nil)

    Aggregation to apply to all data points over the evaluation periods.

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

    Minimum absolute number to adjust capacity with as result of percentage scaling.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'autoscaling/basic_step_scaling_policy_props.rb', line 15

def initialize(metric:, scaling_steps:, adjustment_type: nil, cooldown: nil, datapoints_to_alarm: nil, estimated_instance_warmup: nil, evaluation_periods: nil, metric_aggregation_type: nil, min_adjustment_magnitude: nil)
  @metric = metric
  Jsii::Type.check_type(@metric, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5JTWV0cmljIn0=")), "metric")
  @scaling_steps = scaling_steps.is_a?(Array) ? scaling_steps.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::Autoscaling::ScalingInterval.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : scaling_steps
  Jsii::Type.check_type(@scaling_steps, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hdXRvc2NhbGluZy5TY2FsaW5nSW50ZXJ2YWwifSwia2luZCI6ImFycmF5In19")), "scalingSteps")
  @adjustment_type = adjustment_type
  Jsii::Type.check_type(@adjustment_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuQWRqdXN0bWVudFR5cGUifQ==")), "adjustmentType") unless @adjustment_type.nil?
  @cooldown = cooldown
  Jsii::Type.check_type(@cooldown, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "cooldown") unless @cooldown.nil?
  @datapoints_to_alarm = datapoints_to_alarm
  Jsii::Type.check_type(@datapoints_to_alarm, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "datapointsToAlarm") unless @datapoints_to_alarm.nil?
  @estimated_instance_warmup = estimated_instance_warmup
  Jsii::Type.check_type(@estimated_instance_warmup, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "estimatedInstanceWarmup") unless @estimated_instance_warmup.nil?
  @evaluation_periods = evaluation_periods
  Jsii::Type.check_type(@evaluation_periods, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "evaluationPeriods") unless @evaluation_periods.nil?
  @metric_aggregation_type = metric_aggregation_type
  Jsii::Type.check_type(@metric_aggregation_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuTWV0cmljQWdncmVnYXRpb25UeXBlIn0=")), "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?
end

Instance Attribute Details

#adjustment_typeAWSCDK::Autoscaling::AdjustmentType? (readonly)

Note:

Default: ChangeInCapacity

How the adjustment numbers inside 'intervals' are interpreted.



52
53
54
# File 'autoscaling/basic_step_scaling_policy_props.rb', line 52

def adjustment_type
  @adjustment_type
end

#cooldownAWSCDK::Duration? (readonly)

Note:

Default: Default cooldown period on your AutoScalingGroup

Grace period after scaling activity.

Returns:



57
58
59
# File 'autoscaling/basic_step_scaling_policy_props.rb', line 57

def cooldown
  @cooldown
end

#datapoints_to_alarmNumeric? (readonly)

Note:

Default: - Same as evaluationPeriods

The number of data points out of the evaluation periods that must be breaching to trigger a scaling action.

Creates an "M out of N" alarm, where this property is the M and the value set for evaluation_periods is the N value.

Only has meaning if evaluationPeriods != 1. Must be less than or equal to evaluation_periods.

Returns:

  • (Numeric, nil)


68
69
70
# File 'autoscaling/basic_step_scaling_policy_props.rb', line 68

def datapoints_to_alarm
  @datapoints_to_alarm
end

#estimated_instance_warmupAWSCDK::Duration? (readonly)

Note:

Default: Same as the cooldown

Estimated time until a newly launched instance can send metrics to CloudWatch.

Returns:



73
74
75
# File 'autoscaling/basic_step_scaling_policy_props.rb', line 73

def estimated_instance_warmup
  @estimated_instance_warmup
end

#evaluation_periodsNumeric? (readonly)

Note:

Default: 1

How many evaluation periods of the metric to wait before triggering a scaling action.

Raising this value can be used to smooth out the metric, at the expense of slower response times.

If datapoints_to_alarm is not set, then all data points in the evaluation period must meet the criteria to trigger a scaling action.

Returns:

  • (Numeric, nil)


84
85
86
# File 'autoscaling/basic_step_scaling_policy_props.rb', line 84

def evaluation_periods
  @evaluation_periods
end

#metricAWSCDK::CloudWatch::IMetric (readonly)

Metric to scale on.



39
40
41
# File 'autoscaling/basic_step_scaling_policy_props.rb', line 39

def metric
  @metric
end

#metric_aggregation_typeAWSCDK::Autoscaling::MetricAggregationType? (readonly)

Note:

Default: - The statistic from the metric if applicable (MIN, MAX, AVERAGE), otherwise AVERAGE.

Aggregation to apply to all data points over the evaluation periods.

Only has meaning if evaluationPeriods != 1.



91
92
93
# File 'autoscaling/basic_step_scaling_policy_props.rb', line 91

def metric_aggregation_type
  @metric_aggregation_type
end

#min_adjustment_magnitudeNumeric? (readonly)

Note:

Default: No minimum scaling effect

Minimum absolute number to adjust capacity with as result of percentage scaling.

Only when using AdjustmentType = PercentChangeInCapacity, this number controls the minimum absolute effect size.

Returns:

  • (Numeric, nil)


99
100
101
# File 'autoscaling/basic_step_scaling_policy_props.rb', line 99

def min_adjustment_magnitude
  @min_adjustment_magnitude
end

#scaling_stepsArray<AWSCDK::Autoscaling::ScalingInterval> (readonly)

The intervals for scaling.

Maps a range of metric values to a particular scaling behavior.

Must be between 2 and 40 steps.



47
48
49
# File 'autoscaling/basic_step_scaling_policy_props.rb', line 47

def scaling_steps
  @scaling_steps
end

Class Method Details

.jsii_propertiesObject



101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'autoscaling/basic_step_scaling_policy_props.rb', line 101

def self.jsii_properties
  {
    :metric => "metric",
    :scaling_steps => "scalingSteps",
    :adjustment_type => "adjustmentType",
    :cooldown => "cooldown",
    :datapoints_to_alarm => "datapointsToAlarm",
    :estimated_instance_warmup => "estimatedInstanceWarmup",
    :evaluation_periods => "evaluationPeriods",
    :metric_aggregation_type => "metricAggregationType",
    :min_adjustment_magnitude => "minAdjustmentMagnitude",
  }
end

Instance Method Details

#to_jsiiObject



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'autoscaling/basic_step_scaling_policy_props.rb', line 115

def to_jsii
  result = {}
  result.merge!({
    "metric" => @metric,
    "scalingSteps" => @scaling_steps,
    "adjustmentType" => @adjustment_type,
    "cooldown" => @cooldown,
    "datapointsToAlarm" => @datapoints_to_alarm,
    "estimatedInstanceWarmup" => @estimated_instance_warmup,
    "evaluationPeriods" => @evaluation_periods,
    "metricAggregationType" => @metric_aggregation_type,
    "minAdjustmentMagnitude" => @min_adjustment_magnitude,
  })
  result.compact
end