Class: AWSCDK::ApplicationAutoScaling::CfnScalingPolicy::CustomizedMetricSpecificationProperty

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

Overview

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

For information about the available metrics for a service, see AWS services that publish CloudWatch metrics in the Amazon CloudWatch User Guide .

To create your customized metric specification:

  • Add values for each required parameter 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, and increase when capacity decreases.

For an example of how creating new metrics can be useful, see Scaling based on Amazon SQS in the Amazon EC2 Auto Scaling User Guide . This topic mentions Auto Scaling groups, but the same scenario for Amazon SQS can apply to the target tracking scaling policies that you create for a Spot Fleet by using Application Auto Scaling.

For more information about the CloudWatch terminology below, see Amazon CloudWatch concepts .

CustomizedMetricSpecification is a property of the AWS::ApplicationAutoScaling::ScalingPolicy TargetTrackingScalingPolicyConfiguration 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, statistic: nil, unit: nil) ⇒ CustomizedMetricSpecificationProperty

Returns a new instance of CustomizedMetricSpecificationProperty.

Parameters:



636
637
638
639
640
641
642
643
644
645
646
647
648
649
# File 'application_auto_scaling/cfn_scaling_policy.rb', line 636

def initialize(dimensions: nil, metric_name: nil, metrics: nil, namespace: nil, statistic: nil, unit: nil)
  @dimensions = dimensions
  Jsii::Type.check_type(@dimensions, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBwbGljYXRpb25hdXRvc2NhbGluZy5DZm5TY2FsaW5nUG9saWN5Lk1ldHJpY0RpbWVuc2lvblByb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "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("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBwbGljYXRpb25hdXRvc2NhbGluZy5DZm5TY2FsaW5nUG9saWN5LlRhcmdldFRyYWNraW5nTWV0cmljRGF0YVF1ZXJ5UHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "metrics") unless @metrics.nil?
  @namespace = namespace
  Jsii::Type.check_type(@namespace, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "namespace") unless @namespace.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.



657
658
659
# File 'application_auto_scaling/cfn_scaling_policy.rb', line 657

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's returned by a call to ListMetrics .



664
665
666
# File 'application_auto_scaling/cfn_scaling_policy.rb', line 664

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.



671
672
673
# File 'application_auto_scaling/cfn_scaling_policy.rb', line 671

def metrics
  @metrics
end

#namespaceString? (readonly)

The namespace of the metric.



676
677
678
# File 'application_auto_scaling/cfn_scaling_policy.rb', line 676

def namespace
  @namespace
end

#statisticString? (readonly)

The statistic of the metric.



681
682
683
# File 'application_auto_scaling/cfn_scaling_policy.rb', line 681

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 .



688
689
690
# File 'application_auto_scaling/cfn_scaling_policy.rb', line 688

def unit
  @unit
end

Class Method Details

.jsii_propertiesObject



690
691
692
693
694
695
696
697
698
699
# File 'application_auto_scaling/cfn_scaling_policy.rb', line 690

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

Instance Method Details

#to_jsiiObject



701
702
703
704
705
706
707
708
709
710
711
712
# File 'application_auto_scaling/cfn_scaling_policy.rb', line 701

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