Class: AWSCDK::ApplicationAutoScaling::TargetTrackingScalingPolicyProps

Inherits:
BasicTargetTrackingScalingPolicyProps
  • Object
show all
Defined in:
application_auto_scaling/target_tracking_scaling_policy_props.rb

Overview

Properties for a concrete TargetTrackingPolicy.

Adds the scalingTarget.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(disable_scale_in: nil, policy_name: nil, scale_in_cooldown: nil, scale_out_cooldown: nil, target_value:, custom_metric: nil, predefined_metric: nil, resource_label: nil, scaling_target:) ⇒ TargetTrackingScalingPolicyProps

Returns a new instance of TargetTrackingScalingPolicyProps.

Parameters:

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

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

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

    A name for the scaling policy.

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

    Period after a scale in activity completes before another scale in activity can start.

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

    Period after a scale out activity completes before another scale out activity can start.

  • 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::ApplicationAutoScaling::PredefinedMetric, nil) (defaults to: nil)

    A predefined metric for application autoscaling.

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

    Identify the resource associated with the metric type.

  • scaling_target (AWSCDK::Interfaces::AWSApplicationautoscaling::IScalableTargetRef)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'application_auto_scaling/target_tracking_scaling_policy_props.rb', line 18

def initialize(disable_scale_in: nil, policy_name: nil, scale_in_cooldown: nil, scale_out_cooldown: nil, target_value:, custom_metric: nil, predefined_metric: nil, resource_label: nil, scaling_target:)
  @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?
  @policy_name = policy_name
  Jsii::Type.check_type(@policy_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "policyName") unless @policy_name.nil?
  @scale_in_cooldown = scale_in_cooldown
  Jsii::Type.check_type(@scale_in_cooldown, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "scaleInCooldown") unless @scale_in_cooldown.nil?
  @scale_out_cooldown = scale_out_cooldown
  Jsii::Type.check_type(@scale_out_cooldown, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "scaleOutCooldown") unless @scale_out_cooldown.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("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBwbGljYXRpb25hdXRvc2NhbGluZy5QcmVkZWZpbmVkTWV0cmljIn0=")), "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?
  @scaling_target = scaling_target
  Jsii::Type.check_type(@scaling_target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19hcHBsaWNhdGlvbmF1dG9zY2FsaW5nLklTY2FsYWJsZVRhcmdldFJlZiJ9")), "scalingTarget")
end

Instance Attribute Details

#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:



77
78
79
# File 'application_auto_scaling/target_tracking_scaling_policy_props.rb', line 77

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 scalable resource. Otherwise, scale in is enabled and the target tracking policy can remove capacity from the scalable resource.

Returns:

  • (Boolean, nil)


48
49
50
# File 'application_auto_scaling/target_tracking_scaling_policy_props.rb', line 48

def disable_scale_in
  @disable_scale_in
end

#policy_nameString? (readonly)

Note:

Default: - Automatically generated name.

A name for the scaling policy.

Returns:

  • (String, nil)


53
54
55
# File 'application_auto_scaling/target_tracking_scaling_policy_props.rb', line 53

def policy_name
  @policy_name
end

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

Note:

Default: - No predefined metrics.

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.



87
88
89
# File 'application_auto_scaling/target_tracking_scaling_policy_props.rb', line 87

def predefined_metric
  @predefined_metric
end

#resource_labelString? (readonly)

Note:

Default: - No resource label.

Identify the resource associated with the metric type.

Only used for predefined metric ALBRequestCountPerTarget.

Example value: app/<load-balancer-name>/<load-balancer-id>/targetgroup/<target-group-name>/<target-group-id>

Returns:

  • (String, nil)


96
97
98
# File 'application_auto_scaling/target_tracking_scaling_policy_props.rb', line 96

def resource_label
  @resource_label
end

#scale_in_cooldownAWSCDK::Duration? (readonly)

Note:

Default: Duration.seconds(300) for the following scalable targets: ECS services, Spot Fleet requests, EMR clusters, AppStream 2.0 fleets, Aurora DB clusters, Amazon SageMaker endpoint variants, Custom resources. For all other scalable targets, the default value is Duration.seconds(0): DynamoDB tables, DynamoDB global secondary indexes, Amazon Comprehend document classification endpoints, Lambda provisioned concurrency

Period after a scale in activity completes before another scale in activity can start.

Returns:



58
59
60
# File 'application_auto_scaling/target_tracking_scaling_policy_props.rb', line 58

def scale_in_cooldown
  @scale_in_cooldown
end

#scale_out_cooldownAWSCDK::Duration? (readonly)

Note:

Default: Duration.seconds(300) for the following scalable targets: ECS services, Spot Fleet requests, EMR clusters, AppStream 2.0 fleets, Aurora DB clusters, Amazon SageMaker endpoint variants, Custom resources. For all other scalable targets, the default value is Duration.seconds(0): DynamoDB tables, DynamoDB global secondary indexes, Amazon Comprehend document classification endpoints, Lambda provisioned concurrency

Period after a scale out activity completes before another scale out activity can start.

Returns:



63
64
65
# File 'application_auto_scaling/target_tracking_scaling_policy_props.rb', line 63

def scale_out_cooldown
  @scale_out_cooldown
end

#scaling_targetAWSCDK::Interfaces::AWSApplicationautoscaling::IScalableTargetRef (readonly)



98
99
100
# File 'application_auto_scaling/target_tracking_scaling_policy_props.rb', line 98

def scaling_target
  @scaling_target
end

#target_valueNumeric (readonly)

The target value for the metric.

Returns:

  • (Numeric)


67
68
69
# File 'application_auto_scaling/target_tracking_scaling_policy_props.rb', line 67

def target_value
  @target_value
end

Class Method Details

.jsii_propertiesObject



100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'application_auto_scaling/target_tracking_scaling_policy_props.rb', line 100

def self.jsii_properties
  {
    :disable_scale_in => "disableScaleIn",
    :policy_name => "policyName",
    :scale_in_cooldown => "scaleInCooldown",
    :scale_out_cooldown => "scaleOutCooldown",
    :target_value => "targetValue",
    :custom_metric => "customMetric",
    :predefined_metric => "predefinedMetric",
    :resource_label => "resourceLabel",
    :scaling_target => "scalingTarget",
  }
end

Instance Method Details

#to_jsiiObject



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

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "disableScaleIn" => @disable_scale_in,
    "policyName" => @policy_name,
    "scaleInCooldown" => @scale_in_cooldown,
    "scaleOutCooldown" => @scale_out_cooldown,
    "targetValue" => @target_value,
    "customMetric" => @custom_metric,
    "predefinedMetric" => @predefined_metric,
    "resourceLabel" => @resource_label,
    "scalingTarget" => @scaling_target,
  })
  result.compact
end