Class: AWSCDK::Autoscaling::CfnScalingPolicy::CustomizedMetricSpecificationProperty

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

Overview

Contains customized metric specification information for a target tracking scaling policy for Amazon EC2 Auto Scaling.

To create your customized metric specification:

  • Add values for each required property from CloudWatch. You can use an existing metric, or a new metric that you create. To use your own metric, you must first publish the metric to CloudWatch. For more information, see Publish Custom Metrics in the Amazon CloudWatch User Guide .
  • Choose a metric that changes proportionally with capacity. The value of the metric should increase or decrease in inverse proportion to the number of capacity units. That is, the value of the metric should decrease when capacity increases.

For more information about CloudWatch, see Amazon CloudWatch Concepts .

CustomizedMetricSpecification is a property of the AWS::AutoScaling::ScalingPolicy TargetTrackingConfiguration property type.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dimensions: nil, metric_name: nil, metrics: nil, namespace: nil, period: nil, statistic: nil, unit: nil) ⇒ CustomizedMetricSpecificationProperty

Returns a new instance of CustomizedMetricSpecificationProperty.

Parameters:



668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
# File 'autoscaling/cfn_scaling_policy.rb', line 668

def initialize(dimensions: nil, metric_name: nil, metrics: nil, namespace: nil, period: nil, statistic: nil, unit: nil)
  @dimensions = dimensions
  Jsii::Type.check_type(@dimensions, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuQ2ZuU2NhbGluZ1BvbGljeS5NZXRyaWNEaW1lbnNpb25Qcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "dimensions") unless @dimensions.nil?
  @metric_name = metric_name
  Jsii::Type.check_type(@metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName") unless @metric_name.nil?
  @metrics = metrics
  Jsii::Type.check_type(@metrics, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuQ2ZuU2NhbGluZ1BvbGljeS5UYXJnZXRUcmFja2luZ01ldHJpY0RhdGFRdWVyeVByb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "metrics") unless @metrics.nil?
  @namespace = namespace
  Jsii::Type.check_type(@namespace, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "namespace") unless @namespace.nil?
  @period = period
  Jsii::Type.check_type(@period, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "period") unless @period.nil?
  @statistic = statistic
  Jsii::Type.check_type(@statistic, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "statistic") unless @statistic.nil?
  @unit = unit
  Jsii::Type.check_type(@unit, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "unit") unless @unit.nil?
end

Instance Attribute Details

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

The dimensions of the metric.

Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.



691
692
693
# File 'autoscaling/cfn_scaling_policy.rb', line 691

def dimensions
  @dimensions
end

#metric_nameString? (readonly)

The name of the metric.

To get the exact metric name, namespace, and dimensions, inspect the Metric object that is returned by a call to ListMetrics .



698
699
700
# File 'autoscaling/cfn_scaling_policy.rb', line 698

def metric_name
  @metric_name
end

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

The metrics to include in the target tracking scaling policy, as a metric data query.

This can include both raw metric and metric math expressions.



705
706
707
# File 'autoscaling/cfn_scaling_policy.rb', line 705

def metrics
  @metrics
end

#namespaceString? (readonly)

The namespace of the metric.



710
711
712
# File 'autoscaling/cfn_scaling_policy.rb', line 710

def namespace
  @namespace
end

#periodNumeric? (readonly)

The period of the metric in seconds.

The default value is 60. Accepted values are 10, 30, and 60. For high resolution metric, set the value to less than 60. For more information, see Create a target tracking policy using high-resolution metrics for faster response .



717
718
719
# File 'autoscaling/cfn_scaling_policy.rb', line 717

def period
  @period
end

#statisticString? (readonly)

The statistic of the metric.



722
723
724
# File 'autoscaling/cfn_scaling_policy.rb', line 722

def statistic
  @statistic
end

#unitString? (readonly)

The unit of the metric.

For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference .



729
730
731
# File 'autoscaling/cfn_scaling_policy.rb', line 729

def unit
  @unit
end

Class Method Details

.jsii_propertiesObject



731
732
733
734
735
736
737
738
739
740
741
# File 'autoscaling/cfn_scaling_policy.rb', line 731

def self.jsii_properties
  {
    :dimensions => "dimensions",
    :metric_name => "metricName",
    :metrics => "metrics",
    :namespace => "namespace",
    :period => "period",
    :statistic => "statistic",
    :unit => "unit",
  }
end

Instance Method Details

#to_jsiiObject



743
744
745
746
747
748
749
750
751
752
753
754
755
# File 'autoscaling/cfn_scaling_policy.rb', line 743

def to_jsii
  result = {}
  result.merge!({
    "dimensions" => @dimensions,
    "metricName" => @metric_name,
    "metrics" => @metrics,
    "namespace" => @namespace,
    "period" => @period,
    "statistic" => @statistic,
    "unit" => @unit,
  })
  result.compact
end