CfnScalingPolicyProps
- class aws_cdk.aws_autoscaling.CfnScalingPolicyProps(*, auto_scaling_group_name, adjustment_type=None, cooldown=None, estimated_instance_warmup=None, metric_aggregation_type=None, min_adjustment_magnitude=None, policy_type=None, predictive_scaling_configuration=None, scaling_adjustment=None, step_adjustments=None, target_tracking_configuration=None)
Bases:
object
Properties for defining a
CfnScalingPolicy
.- Parameters:
auto_scaling_group_name (
str
) – The name of the Auto Scaling group.adjustment_type (
Optional
[str
]) – Specifies how the scaling adjustment is interpreted (for example, an absolute number or a percentage). The valid values areChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
. Required if the policy type isStepScaling
orSimpleScaling
. For more information, see Scaling adjustment types in the Amazon EC2 Auto Scaling User Guide .cooldown (
Optional
[str
]) – A cooldown period, in seconds, that applies to a specific simple scaling policy. When a cooldown period is specified here, it overrides the default cooldown. Valid only if the policy type isSimpleScaling
. For more information, see Scaling cooldowns for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide . Default: Noneestimated_instance_warmup (
Union
[int
,float
,None
]) – Not needed if the default instance warmup is defined for the group.. The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. This warm-up period applies to instances launched due to a specific target tracking or step scaling policy. When a warm-up period is specified here, it overrides the default instance warmup. Valid only if the policy type isTargetTrackingScaling
orStepScaling
. .. epigraph:: The default is to use the value for the default instance warmup defined for the group. If default instance warmup is null, thenEstimatedInstanceWarmup
falls back to the value of default cooldown.metric_aggregation_type (
Optional
[str
]) – The aggregation type for the CloudWatch metrics. The valid values areMinimum
,Maximum
, andAverage
. If the aggregation type is null, the value is treated asAverage
. Valid only if the policy type isStepScaling
.min_adjustment_magnitude (
Union
[int
,float
,None
]) –The minimum value to scale by when the adjustment type is
PercentChangeInCapacity
. For example, suppose that you create a step scaling policy to scale out an Auto Scaling group by 25 percent and you specify aMinAdjustmentMagnitude
of 2. If the group has 4 instances and the scaling policy is performed, 25 percent of 4 is 1. However, because you specified aMinAdjustmentMagnitude
of 2, Amazon EC2 Auto Scaling scales out the group by 2 instances. Valid only if the policy type isStepScaling
orSimpleScaling
. For more information, see Scaling adjustment types in the Amazon EC2 Auto Scaling User Guide . .. epigraph:: Some Auto Scaling groups use instance weights. In this case, set theMinAdjustmentMagnitude
to a value that is at least as large as your largest instance weight.policy_type (
Optional
[str
]) – One of the following policy types:. -TargetTrackingScaling
-StepScaling
-SimpleScaling
(default) -PredictiveScaling
predictive_scaling_configuration (
Union
[IResolvable
,PredictiveScalingConfigurationProperty
,Dict
[str
,Any
],None
]) – A predictive scaling policy. Provides support for predefined and custom metrics. Predefined metrics include CPU utilization, network in/out, and the Application Load Balancer request count. Required if the policy type isPredictiveScaling
.scaling_adjustment (
Union
[int
,float
,None
]) – The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity. For exact capacity, you must specify a non-negative value. Required if the policy type isSimpleScaling
. (Not used with any other policy type.)step_adjustments (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,StepAdjustmentProperty
,Dict
[str
,Any
]]],None
]) – A set of adjustments that enable you to scale based on the size of the alarm breach. Required if the policy type isStepScaling
. (Not used with any other policy type.)target_tracking_configuration (
Union
[IResolvable
,TargetTrackingConfigurationProperty
,Dict
[str
,Any
],None
]) – A target tracking scaling policy. Provides support for predefined or custom metrics. The following predefined metrics are available: -ASGAverageCPUUtilization
-ASGAverageNetworkIn
-ASGAverageNetworkOut
-ALBRequestCountPerTarget
If you specifyALBRequestCountPerTarget
for the metric, you must specify theResourceLabel
property with thePredefinedMetricSpecification
. Required if the policy type isTargetTrackingScaling
.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_autoscaling as autoscaling cfn_scaling_policy_props = autoscaling.CfnScalingPolicyProps( auto_scaling_group_name="autoScalingGroupName", # the properties below are optional adjustment_type="adjustmentType", cooldown="cooldown", estimated_instance_warmup=123, metric_aggregation_type="metricAggregationType", min_adjustment_magnitude=123, policy_type="policyType", predictive_scaling_configuration=autoscaling.CfnScalingPolicy.PredictiveScalingConfigurationProperty( metric_specifications=[autoscaling.CfnScalingPolicy.PredictiveScalingMetricSpecificationProperty( target_value=123, # the properties below are optional customized_capacity_metric_specification=autoscaling.CfnScalingPolicy.PredictiveScalingCustomizedCapacityMetricProperty( metric_data_queries=[autoscaling.CfnScalingPolicy.MetricDataQueryProperty( id="id", # the properties below are optional expression="expression", label="label", metric_stat=autoscaling.CfnScalingPolicy.MetricStatProperty( metric=autoscaling.CfnScalingPolicy.MetricProperty( metric_name="metricName", namespace="namespace", # the properties below are optional dimensions=[autoscaling.CfnScalingPolicy.MetricDimensionProperty( name="name", value="value" )] ), stat="stat", # the properties below are optional unit="unit" ), return_data=False )] ), customized_load_metric_specification=autoscaling.CfnScalingPolicy.PredictiveScalingCustomizedLoadMetricProperty( metric_data_queries=[autoscaling.CfnScalingPolicy.MetricDataQueryProperty( id="id", # the properties below are optional expression="expression", label="label", metric_stat=autoscaling.CfnScalingPolicy.MetricStatProperty( metric=autoscaling.CfnScalingPolicy.MetricProperty( metric_name="metricName", namespace="namespace", # the properties below are optional dimensions=[autoscaling.CfnScalingPolicy.MetricDimensionProperty( name="name", value="value" )] ), stat="stat", # the properties below are optional unit="unit" ), return_data=False )] ), customized_scaling_metric_specification=autoscaling.CfnScalingPolicy.PredictiveScalingCustomizedScalingMetricProperty( metric_data_queries=[autoscaling.CfnScalingPolicy.MetricDataQueryProperty( id="id", # the properties below are optional expression="expression", label="label", metric_stat=autoscaling.CfnScalingPolicy.MetricStatProperty( metric=autoscaling.CfnScalingPolicy.MetricProperty( metric_name="metricName", namespace="namespace", # the properties below are optional dimensions=[autoscaling.CfnScalingPolicy.MetricDimensionProperty( name="name", value="value" )] ), stat="stat", # the properties below are optional unit="unit" ), return_data=False )] ), predefined_load_metric_specification=autoscaling.CfnScalingPolicy.PredictiveScalingPredefinedLoadMetricProperty( predefined_metric_type="predefinedMetricType", # the properties below are optional resource_label="resourceLabel" ), predefined_metric_pair_specification=autoscaling.CfnScalingPolicy.PredictiveScalingPredefinedMetricPairProperty( predefined_metric_type="predefinedMetricType", # the properties below are optional resource_label="resourceLabel" ), predefined_scaling_metric_specification=autoscaling.CfnScalingPolicy.PredictiveScalingPredefinedScalingMetricProperty( predefined_metric_type="predefinedMetricType", # the properties below are optional resource_label="resourceLabel" ) )], # the properties below are optional max_capacity_breach_behavior="maxCapacityBreachBehavior", max_capacity_buffer=123, mode="mode", scheduling_buffer_time=123 ), scaling_adjustment=123, step_adjustments=[autoscaling.CfnScalingPolicy.StepAdjustmentProperty( scaling_adjustment=123, # the properties below are optional metric_interval_lower_bound=123, metric_interval_upper_bound=123 )], target_tracking_configuration=autoscaling.CfnScalingPolicy.TargetTrackingConfigurationProperty( target_value=123, # the properties below are optional customized_metric_specification=autoscaling.CfnScalingPolicy.CustomizedMetricSpecificationProperty( dimensions=[autoscaling.CfnScalingPolicy.MetricDimensionProperty( name="name", value="value" )], metric_name="metricName", metrics=[autoscaling.CfnScalingPolicy.TargetTrackingMetricDataQueryProperty( id="id", # the properties below are optional expression="expression", label="label", metric_stat=autoscaling.CfnScalingPolicy.TargetTrackingMetricStatProperty( metric=autoscaling.CfnScalingPolicy.MetricProperty( metric_name="metricName", namespace="namespace", # the properties below are optional dimensions=[autoscaling.CfnScalingPolicy.MetricDimensionProperty( name="name", value="value" )] ), stat="stat", # the properties below are optional period=123, unit="unit" ), period=123, return_data=False )], namespace="namespace", period=123, statistic="statistic", unit="unit" ), disable_scale_in=False, predefined_metric_specification=autoscaling.CfnScalingPolicy.PredefinedMetricSpecificationProperty( predefined_metric_type="predefinedMetricType", # the properties below are optional resource_label="resourceLabel" ) ) )
Attributes
- adjustment_type
Specifies how the scaling adjustment is interpreted (for example, an absolute number or a percentage).
The valid values are
ChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
.Required if the policy type is
StepScaling
orSimpleScaling
. For more information, see Scaling adjustment types in the Amazon EC2 Auto Scaling User Guide .
- auto_scaling_group_name
The name of the Auto Scaling group.
- cooldown
A cooldown period, in seconds, that applies to a specific simple scaling policy.
When a cooldown period is specified here, it overrides the default cooldown.
Valid only if the policy type is
SimpleScaling
. For more information, see Scaling cooldowns for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide .Default: None
- estimated_instance_warmup
Not needed if the default instance warmup is defined for the group..
The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. This warm-up period applies to instances launched due to a specific target tracking or step scaling policy. When a warm-up period is specified here, it overrides the default instance warmup.
Valid only if the policy type is
TargetTrackingScaling
orStepScaling
. .. epigraph:The default is to use the value for the default instance warmup defined for the group. If default instance warmup is null, then ``EstimatedInstanceWarmup`` falls back to the value of default cooldown.
- metric_aggregation_type
The aggregation type for the CloudWatch metrics.
The valid values are
Minimum
,Maximum
, andAverage
. If the aggregation type is null, the value is treated asAverage
.Valid only if the policy type is
StepScaling
.
- min_adjustment_magnitude
The minimum value to scale by when the adjustment type is
PercentChangeInCapacity
.For example, suppose that you create a step scaling policy to scale out an Auto Scaling group by 25 percent and you specify a
MinAdjustmentMagnitude
of 2. If the group has 4 instances and the scaling policy is performed, 25 percent of 4 is 1. However, because you specified aMinAdjustmentMagnitude
of 2, Amazon EC2 Auto Scaling scales out the group by 2 instances.Valid only if the policy type is
StepScaling
orSimpleScaling
. For more information, see Scaling adjustment types in the Amazon EC2 Auto Scaling User Guide . .. epigraph:Some Auto Scaling groups use instance weights. In this case, set the ``MinAdjustmentMagnitude`` to a value that is at least as large as your largest instance weight.
- policy_type
.
TargetTrackingScaling
StepScaling
SimpleScaling
(default)PredictiveScaling
- See:
- Type:
One of the following policy types
- predictive_scaling_configuration
A predictive scaling policy. Provides support for predefined and custom metrics.
Predefined metrics include CPU utilization, network in/out, and the Application Load Balancer request count.
Required if the policy type is
PredictiveScaling
.
- scaling_adjustment
The amount by which to scale, based on the specified adjustment type.
A positive value adds to the current capacity while a negative number removes from the current capacity. For exact capacity, you must specify a non-negative value.
Required if the policy type is
SimpleScaling
. (Not used with any other policy type.)
- step_adjustments
A set of adjustments that enable you to scale based on the size of the alarm breach.
Required if the policy type is
StepScaling
. (Not used with any other policy type.)
- target_tracking_configuration
A target tracking scaling policy. Provides support for predefined or custom metrics.
The following predefined metrics are available:
ASGAverageCPUUtilization
ASGAverageNetworkIn
ASGAverageNetworkOut
ALBRequestCountPerTarget
If you specify
ALBRequestCountPerTarget
for the metric, you must specify theResourceLabel
property with thePredefinedMetricSpecification
.Required if the policy type is
TargetTrackingScaling
.