Class: AWSCDK::Autoscaling::CfnScalingPolicy::TargetTrackingConfigurationProperty

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

Overview

TargetTrackingConfiguration is a property of the AWS::AutoScaling::ScalingPolicy resource that specifies a target tracking scaling policy configuration for Amazon EC2 Auto Scaling.

For more information about scaling policies, see Dynamic scaling in the Amazon EC2 Auto Scaling User Guide .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target_value:, customized_metric_specification: nil, disable_scale_in: nil, predefined_metric_specification: nil) ⇒ TargetTrackingConfigurationProperty

Returns a new instance of TargetTrackingConfigurationProperty.

Parameters:



1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
# File 'autoscaling/cfn_scaling_policy.rb', line 1666

def initialize(target_value:, customized_metric_specification: nil, disable_scale_in: nil, predefined_metric_specification: nil)
  @target_value = target_value
  Jsii::Type.check_type(@target_value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "targetValue")
  @customized_metric_specification = customized_metric_specification.is_a?(Hash) ? ::AWSCDK::Autoscaling::CfnScalingPolicy::CustomizedMetricSpecificationProperty.new(**customized_metric_specification.transform_keys(&:to_sym)) : customized_metric_specification
  Jsii::Type.check_type(@customized_metric_specification, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hdXRvc2NhbGluZy5DZm5TY2FsaW5nUG9saWN5LkN1c3RvbWl6ZWRNZXRyaWNTcGVjaWZpY2F0aW9uUHJvcGVydHkifV19fQ==")), "customizedMetricSpecification") unless @customized_metric_specification.nil?
  @disable_scale_in = disable_scale_in
  Jsii::Type.check_type(@disable_scale_in, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "disableScaleIn") unless @disable_scale_in.nil?
  @predefined_metric_specification = predefined_metric_specification.is_a?(Hash) ? ::AWSCDK::Autoscaling::CfnScalingPolicy::PredefinedMetricSpecificationProperty.new(**predefined_metric_specification.transform_keys(&:to_sym)) : predefined_metric_specification
  Jsii::Type.check_type(@predefined_metric_specification, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hdXRvc2NhbGluZy5DZm5TY2FsaW5nUG9saWN5LlByZWRlZmluZWRNZXRyaWNTcGVjaWZpY2F0aW9uUHJvcGVydHkifV19fQ==")), "predefinedMetricSpecification") unless @predefined_metric_specification.nil?
end

Instance Attribute Details

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

A customized metric.

You must specify either a predefined metric or a customized metric.



1690
1691
1692
# File 'autoscaling/cfn_scaling_policy.rb', line 1690

def customized_metric_specification
  @customized_metric_specification
end

#disable_scale_inBoolean, ... (readonly)

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

If scaling in is disabled, the target tracking scaling policy doesn't remove instances from the Auto Scaling group. Otherwise, the target tracking scaling policy can remove instances from the Auto Scaling group. The default is false .



1697
1698
1699
# File 'autoscaling/cfn_scaling_policy.rb', line 1697

def disable_scale_in
  @disable_scale_in
end

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

A predefined metric.

You must specify either a predefined metric or a customized metric.



1704
1705
1706
# File 'autoscaling/cfn_scaling_policy.rb', line 1704

def predefined_metric_specification
  @predefined_metric_specification
end

#target_valueNumeric (readonly)

The target value for the metric.

Some metrics are based on a count instead of a percentage, such as the request count for an Application Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify the target utilization as the optimal average request or message count per instance during any one-minute interval.



1683
1684
1685
# File 'autoscaling/cfn_scaling_policy.rb', line 1683

def target_value
  @target_value
end

Class Method Details

.jsii_propertiesObject



1706
1707
1708
1709
1710
1711
1712
1713
# File 'autoscaling/cfn_scaling_policy.rb', line 1706

def self.jsii_properties
  {
    :target_value => "targetValue",
    :customized_metric_specification => "customizedMetricSpecification",
    :disable_scale_in => "disableScaleIn",
    :predefined_metric_specification => "predefinedMetricSpecification",
  }
end

Instance Method Details

#to_jsiiObject



1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
# File 'autoscaling/cfn_scaling_policy.rb', line 1715

def to_jsii
  result = {}
  result.merge!({
    "targetValue" => @target_value,
    "customizedMetricSpecification" => @customized_metric_specification,
    "disableScaleIn" => @disable_scale_in,
    "predefinedMetricSpecification" => @predefined_metric_specification,
  })
  result.compact
end