Class: AWSCDK::Autoscaling::CfnScalingPolicy::PredictiveScalingConfigurationProperty

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

Overview

PredictiveScalingConfiguration is a property of the AWS::AutoScaling::ScalingPolicy resource that specifies a predictive scaling policy for Amazon EC2 Auto Scaling.

For more information, see Predictive scaling in the Amazon EC2 Auto Scaling User Guide .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metric_specifications:, max_capacity_breach_behavior: nil, max_capacity_buffer: nil, mode: nil, scheduling_buffer_time: nil) ⇒ PredictiveScalingConfigurationProperty

Returns a new instance of PredictiveScalingConfigurationProperty.

Parameters:

  • metric_specifications (AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::Autoscaling::CfnScalingPolicy::PredictiveScalingMetricSpecificationProperty>)

    This structure includes the metrics and target utilization to use for predictive scaling.

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

    Defines the behavior that should be applied if the forecast capacity approaches or exceeds the maximum capacity of the Auto Scaling group.

  • max_capacity_buffer (Numeric, nil) (defaults to: nil)

    The size of the capacity buffer to use when the forecast capacity is close to or exceeds the maximum capacity.

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

    The predictive scaling mode.

  • scheduling_buffer_time (Numeric, nil) (defaults to: nil)

    The amount of time, in seconds, by which the instance launch time can be advanced.



1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
# File 'autoscaling/cfn_scaling_policy.rb', line 1104

def initialize(metric_specifications:, max_capacity_breach_behavior: nil, max_capacity_buffer: nil, mode: nil, scheduling_buffer_time: nil)
  @metric_specifications = metric_specifications
  Jsii::Type.check_type(@metric_specifications, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuQ2ZuU2NhbGluZ1BvbGljeS5QcmVkaWN0aXZlU2NhbGluZ01ldHJpY1NwZWNpZmljYXRpb25Qcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "metricSpecifications")
  @max_capacity_breach_behavior = max_capacity_breach_behavior
  Jsii::Type.check_type(@max_capacity_breach_behavior, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "maxCapacityBreachBehavior") unless @max_capacity_breach_behavior.nil?
  @max_capacity_buffer = max_capacity_buffer
  Jsii::Type.check_type(@max_capacity_buffer, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxCapacityBuffer") unless @max_capacity_buffer.nil?
  @mode = mode
  Jsii::Type.check_type(@mode, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "mode") unless @mode.nil?
  @scheduling_buffer_time = scheduling_buffer_time
  Jsii::Type.check_type(@scheduling_buffer_time, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "schedulingBufferTime") unless @scheduling_buffer_time.nil?
end

Instance Attribute Details

#max_capacity_breach_behaviorString? (readonly)

Defines the behavior that should be applied if the forecast capacity approaches or exceeds the maximum capacity of the Auto Scaling group.

Defaults to HonorMaxCapacity if not specified.

The following are possible values:

  • HonorMaxCapacity - Amazon EC2 Auto Scaling can't increase the maximum capacity of the group when the forecast capacity is close to or exceeds the maximum capacity.
  • IncreaseMaxCapacity - Amazon EC2 Auto Scaling can increase the maximum capacity of the group when the forecast capacity is close to or exceeds the maximum capacity. The upper limit is determined by the forecasted capacity and the value for MaxCapacityBuffer .

Use caution when allowing the maximum capacity to be automatically increased. This can lead to more instances being launched than intended if the increased maximum capacity is not monitored and managed. The increased maximum capacity then becomes the new normal maximum capacity for the Auto Scaling group until you manually update it. The maximum capacity does not automatically decrease back to the original maximum.



1137
1138
1139
# File 'autoscaling/cfn_scaling_policy.rb', line 1137

def max_capacity_breach_behavior
  @max_capacity_breach_behavior
end

#max_capacity_bufferNumeric? (readonly)

The size of the capacity buffer to use when the forecast capacity is close to or exceeds the maximum capacity.

The value is specified as a percentage relative to the forecast capacity. For example, if the buffer is 10, this means a 10 percent buffer, such that if the forecast capacity is 50, and the maximum capacity is 40, then the effective maximum capacity is 55.

If set to 0, Amazon EC2 Auto Scaling may scale capacity higher than the maximum capacity to equal but not exceed forecast capacity.

Required if the MaxCapacityBreachBehavior property is set to IncreaseMaxCapacity , and cannot be used otherwise.



1148
1149
1150
# File 'autoscaling/cfn_scaling_policy.rb', line 1148

def max_capacity_buffer
  @max_capacity_buffer
end

#metric_specificationsAWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::Autoscaling::CfnScalingPolicy::PredictiveScalingMetricSpecificationProperty> (readonly)

This structure includes the metrics and target utilization to use for predictive scaling.

This is an array, but we currently only support a single metric specification. That is, you can specify a target value and a single metric pair, or a target value and one scaling metric and one load metric.



1123
1124
1125
# File 'autoscaling/cfn_scaling_policy.rb', line 1123

def metric_specifications
  @metric_specifications
end

#modeString? (readonly)

The predictive scaling mode.

Defaults to ForecastOnly if not specified.



1155
1156
1157
# File 'autoscaling/cfn_scaling_policy.rb', line 1155

def mode
  @mode
end

#scheduling_buffer_timeNumeric? (readonly)

The amount of time, in seconds, by which the instance launch time can be advanced.

For example, the forecast says to add capacity at 10:00 AM, and you choose to pre-launch instances by 5 minutes. In that case, the instances will be launched at 9:55 AM. The intention is to give resources time to be provisioned. It can take a few minutes to launch an EC2 instance. The actual amount of time required depends on several factors, such as the size of the instance and whether there are startup scripts to complete.

The value must be less than the forecast interval duration of 3600 seconds (60 minutes). Defaults to 300 seconds if not specified.



1164
1165
1166
# File 'autoscaling/cfn_scaling_policy.rb', line 1164

def scheduling_buffer_time
  @scheduling_buffer_time
end

Class Method Details

.jsii_propertiesObject



1166
1167
1168
1169
1170
1171
1172
1173
1174
# File 'autoscaling/cfn_scaling_policy.rb', line 1166

def self.jsii_properties
  {
    :metric_specifications => "metricSpecifications",
    :max_capacity_breach_behavior => "maxCapacityBreachBehavior",
    :max_capacity_buffer => "maxCapacityBuffer",
    :mode => "mode",
    :scheduling_buffer_time => "schedulingBufferTime",
  }
end

Instance Method Details

#to_jsiiObject



1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
# File 'autoscaling/cfn_scaling_policy.rb', line 1176

def to_jsii
  result = {}
  result.merge!({
    "metricSpecifications" => @metric_specifications,
    "maxCapacityBreachBehavior" => @max_capacity_breach_behavior,
    "maxCapacityBuffer" => @max_capacity_buffer,
    "mode" => @mode,
    "schedulingBufferTime" => @scheduling_buffer_time,
  })
  result.compact
end