Class: AWSCDK::Autoscaling::BasicTargetTrackingScalingPolicyProps

Inherits:
BaseTargetTrackingProps
  • Object
show all
Defined in:
autoscaling/basic_target_tracking_scaling_policy_props.rb

Overview

Properties for a Target Tracking policy that include the metric but exclude the target.

Direct Known Subclasses

TargetTrackingScalingPolicyProps

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cooldown: nil, disable_scale_in: nil, estimated_instance_warmup: nil, target_value:, custom_metric: nil, predefined_metric: nil, resource_label: nil) ⇒ BasicTargetTrackingScalingPolicyProps

Returns a new instance of BasicTargetTrackingScalingPolicyProps.

Parameters:

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

    Period after a scaling completes before another scaling activity can start.

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

    Indicates whether scale in by the target tracking policy is disabled.

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

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

  • target_value (Numeric)

    The target value for the metric.

  • custom_metric (AWSCDK::CloudWatch::IMetric, nil) (defaults to: nil)

    A custom metric for application autoscaling.

  • predefined_metric (AWSCDK::Autoscaling::PredefinedMetric, nil) (defaults to: nil)

    A predefined metric for application autoscaling.

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

    The resource label associated with the predefined metric.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'autoscaling/basic_target_tracking_scaling_policy_props.rb', line 14

def initialize(cooldown: nil, disable_scale_in: nil, estimated_instance_warmup: nil, target_value:, custom_metric: nil, predefined_metric: nil, resource_label: nil)
  @cooldown = cooldown
  Jsii::Type.check_type(@cooldown, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "cooldown") unless @cooldown.nil?
  @disable_scale_in = disable_scale_in
  Jsii::Type.check_type(@disable_scale_in, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "disableScaleIn") unless @disable_scale_in.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?
  @target_value = target_value
  Jsii::Type.check_type(@target_value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "targetValue")
  @custom_metric = custom_metric
  Jsii::Type.check_type(@custom_metric, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5JTWV0cmljIn0=")), "customMetric") unless @custom_metric.nil?
  @predefined_metric = predefined_metric
  Jsii::Type.check_type(@predefined_metric, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuUHJlZGVmaW5lZE1ldHJpYyJ9")), "predefinedMetric") unless @predefined_metric.nil?
  @resource_label = resource_label
  Jsii::Type.check_type(@resource_label, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "resourceLabel") unless @resource_label.nil?
end

Instance Attribute Details

#cooldownAWSCDK::Duration? (readonly)

Note:

Default: - The default cooldown configured on the AutoScalingGroup.

Period after a scaling completes before another scaling activity can start.

Returns:



35
36
37
# File 'autoscaling/basic_target_tracking_scaling_policy_props.rb', line 35

def cooldown
  @cooldown
end

#custom_metricAWSCDK::CloudWatch::IMetric? (readonly)

Note:

Default: - No custom metric.

A custom metric for application autoscaling.

The metric must track utilization. Scaling out will happen if the metric is higher than the target value, scaling in will happen in the metric is lower than the target value.

Exactly one of customMetric or predefinedMetric must be specified.

Returns:



64
65
66
# File 'autoscaling/basic_target_tracking_scaling_policy_props.rb', line 64

def custom_metric
  @custom_metric
end

#disable_scale_inBoolean? (readonly)

Note:

Default: false

Indicates whether scale in by the target tracking policy is disabled.

If the value is true, scale in is disabled and the target tracking policy won't remove capacity from the autoscaling group. Otherwise, scale in is enabled and the target tracking policy can remove capacity from the group.

Returns:

  • (Boolean, nil)


45
46
47
# File 'autoscaling/basic_target_tracking_scaling_policy_props.rb', line 45

def disable_scale_in
  @disable_scale_in
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:



50
51
52
# File 'autoscaling/basic_target_tracking_scaling_policy_props.rb', line 50

def estimated_instance_warmup
  @estimated_instance_warmup
end

#predefined_metricAWSCDK::Autoscaling::PredefinedMetric? (readonly)

Note:

Default: - No predefined metric.

A predefined metric for application autoscaling.

The metric must track utilization. Scaling out will happen if the metric is higher than the target value, scaling in will happen in the metric is lower than the target value.

Exactly one of customMetric or predefinedMetric must be specified.



74
75
76
# File 'autoscaling/basic_target_tracking_scaling_policy_props.rb', line 74

def predefined_metric
  @predefined_metric
end

#resource_labelString? (readonly)

Note:

Default: - No resource label.

The resource label associated with the predefined metric.

Should be supplied if the predefined metric is ALBRequestCountPerTarget, and the format should be:

app///targetgroup//

Returns:

  • (String, nil)


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

def resource_label
  @resource_label
end

#target_valueNumeric (readonly)

The target value for the metric.

Returns:

  • (Numeric)


54
55
56
# File 'autoscaling/basic_target_tracking_scaling_policy_props.rb', line 54

def target_value
  @target_value
end

Class Method Details

.jsii_propertiesObject



86
87
88
89
90
91
92
93
94
95
96
# File 'autoscaling/basic_target_tracking_scaling_policy_props.rb', line 86

def self.jsii_properties
  {
    :cooldown => "cooldown",
    :disable_scale_in => "disableScaleIn",
    :estimated_instance_warmup => "estimatedInstanceWarmup",
    :target_value => "targetValue",
    :custom_metric => "customMetric",
    :predefined_metric => "predefinedMetric",
    :resource_label => "resourceLabel",
  }
end

Instance Method Details

#to_jsiiObject



98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'autoscaling/basic_target_tracking_scaling_policy_props.rb', line 98

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "cooldown" => @cooldown,
    "disableScaleIn" => @disable_scale_in,
    "estimatedInstanceWarmup" => @estimated_instance_warmup,
    "targetValue" => @target_value,
    "customMetric" => @custom_metric,
    "predefinedMetric" => @predefined_metric,
    "resourceLabel" => @resource_label,
  })
  result.compact
end