Class: AWSCDK::Autoscaling::MetricTargetTrackingProps

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

Overview

Properties for enabling tracking of an arbitrary metric.

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, metric:, target_value:) ⇒ MetricTargetTrackingProps

Returns a new instance of MetricTargetTrackingProps.

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.

  • metric (AWSCDK::CloudWatch::IMetric)

    Metric to track.

  • target_value (Numeric)

    Value to keep the metric around.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'autoscaling/metric_target_tracking_props.rb', line 12

def initialize(cooldown: nil, disable_scale_in: nil, estimated_instance_warmup: nil, metric:, target_value:)
  @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?
  @metric = metric
  Jsii::Type.check_type(@metric, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5JTWV0cmljIn0=")), "metric")
  @target_value = target_value
  Jsii::Type.check_type(@target_value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "targetValue")
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:



29
30
31
# File 'autoscaling/metric_target_tracking_props.rb', line 29

def cooldown
  @cooldown
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)


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

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:



44
45
46
# File 'autoscaling/metric_target_tracking_props.rb', line 44

def estimated_instance_warmup
  @estimated_instance_warmup
end

#metricAWSCDK::CloudWatch::IMetric (readonly)

Metric to track.

The metric must represent a utilization, so that if it's higher than the target value, your ASG should scale out, and if it's lower it should scale in.



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

def metric
  @metric
end

#target_valueNumeric (readonly)

Value to keep the metric around.

Returns:

  • (Numeric)


56
57
58
# File 'autoscaling/metric_target_tracking_props.rb', line 56

def target_value
  @target_value
end

Class Method Details

.jsii_propertiesObject



58
59
60
61
62
63
64
65
66
# File 'autoscaling/metric_target_tracking_props.rb', line 58

def self.jsii_properties
  {
    :cooldown => "cooldown",
    :disable_scale_in => "disableScaleIn",
    :estimated_instance_warmup => "estimatedInstanceWarmup",
    :metric => "metric",
    :target_value => "targetValue",
  }
end

Instance Method Details

#to_jsiiObject



68
69
70
71
72
73
74
75
76
77
78
79
# File 'autoscaling/metric_target_tracking_props.rb', line 68

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "cooldown" => @cooldown,
    "disableScaleIn" => @disable_scale_in,
    "estimatedInstanceWarmup" => @estimated_instance_warmup,
    "metric" => @metric,
    "targetValue" => @target_value,
  })
  result.compact
end