Class: AWSCDK::AutoScalingPlans::CfnScalingPlan::CustomizedLoadMetricSpecificationProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
auto_scaling_plans/cfn_scaling_plan.rb

Overview

CustomizedLoadMetricSpecification is a subproperty of ScalingInstruction that specifies a customized load metric for predictive scaling to use with a scaling plan.

For predictive scaling to work with a customized load metric specification, AWS Auto Scaling needs access to the Sum and Average statistics that CloudWatch computes from metric data.

When you choose a load metric, make sure that the required Sum and Average statistics for your metric are available in CloudWatch and that they provide relevant data for predictive scaling. The Sum statistic must represent the total load on the resource, and the Average statistic must represent the average load per capacity unit of the resource. For example, there is a metric that counts the number of requests processed by your Auto Scaling group. If the Sum statistic represents the total request count processed by the group, then the Average statistic for the specified metric must represent the average request count processed by each instance of the group.

If you publish your own metrics, you can aggregate the data points at a given interval and then publish the aggregated data points to CloudWatch. Before AWS Auto Scaling generates the forecast, it sums up all the metric data points that occurred within each hour to match the granularity period that is used in the forecast (60 minutes).

For information about terminology, available metrics, or how to publish new metrics, see Amazon CloudWatch Concepts in the Amazon CloudWatch User Guide .

After creating your scaling plan, you can use the AWS Auto Scaling console to visualize forecasts for the specified metric. For more information, see View scaling information for a resource in the Scaling Plans User Guide .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metric_name:, namespace:, statistic:, dimensions: nil, unit: nil) ⇒ CustomizedLoadMetricSpecificationProperty

Returns a new instance of CustomizedLoadMetricSpecificationProperty.

Parameters:



599
600
601
602
603
604
605
606
607
608
609
610
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 599

def initialize(metric_name:, namespace:, statistic:, dimensions: nil, unit: nil)
  @metric_name = metric_name
  Jsii::Type.check_type(@metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName")
  @namespace = namespace
  Jsii::Type.check_type(@namespace, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "namespace")
  @statistic = statistic
  Jsii::Type.check_type(@statistic, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "statistic")
  @dimensions = dimensions
  Jsii::Type.check_type(@dimensions, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmdwbGFucy5DZm5TY2FsaW5nUGxhbi5NZXRyaWNEaW1lbnNpb25Qcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "dimensions") unless @dimensions.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 customized load metric specification.



635
636
637
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 635

def dimensions
  @dimensions
end

#metric_nameString (readonly)

The name of the metric.



616
617
618
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 616

def metric_name
  @metric_name
end

#namespaceString (readonly)

The namespace of the metric.



621
622
623
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 621

def namespace
  @namespace
end

#statisticString (readonly)

The statistic of the metric.

Allowed Values : Sum



628
629
630
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 628

def statistic
  @statistic
end

#unitString? (readonly)

The unit of the metric.



640
641
642
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 640

def unit
  @unit
end

Class Method Details

.jsii_propertiesObject



642
643
644
645
646
647
648
649
650
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 642

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

Instance Method Details

#to_jsiiObject



652
653
654
655
656
657
658
659
660
661
662
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 652

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