CfnScalingPolicy

class aws_cdk.aws_autoscaling.CfnScalingPolicy(scope, id, *, 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: aws_cdk.core.CfnResource

A CloudFormation AWS::AutoScaling::ScalingPolicy.

The AWS::AutoScaling::ScalingPolicy resource specifies an Amazon EC2 Auto Scaling scaling policy so that the Auto Scaling group can scale the number of instances available for your application.

For more information about using scaling policies to scale your Auto Scaling group automatically, see Dynamic scaling and Predictive scaling in the Amazon EC2 Auto Scaling User Guide .

CloudformationResource

AWS::AutoScaling::ScalingPolicy

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_autoscaling as autoscaling

cfn_scaling_policy = autoscaling.CfnScalingPolicy(self, "MyCfnScalingPolicy",
    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
            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(
            metric_name="metricName",
            namespace="namespace",
            statistic="statistic",

            # the properties below are optional
            dimensions=[autoscaling.CfnScalingPolicy.MetricDimensionProperty(
                name="name",
                value="value"
            )],
            unit="unit"
        ),
        disable_scale_in=False,
        predefined_metric_specification=autoscaling.CfnScalingPolicy.PredefinedMetricSpecificationProperty(
            predefined_metric_type="predefinedMetricType",

            # the properties below are optional
            resource_label="resourceLabel"
        )
    )
)

Create a new AWS::AutoScaling::ScalingPolicy.

Parameters
  • scope (Construct) –

    • scope in which this resource is defined.

  • id (str) –

    • scoped id of the resource.

  • auto_scaling_group_name (str) – The name of the Auto Scaling group.

  • adjustment_type (Optional[str]) – Specifies how the scaling adjustment is interpreted. The valid values are ChangeInCapacity , ExactCapacity , and PercentChangeInCapacity . Required if the policy type is StepScaling or SimpleScaling . For more information, see Scaling adjustment types in the Amazon EC2 Auto Scaling User Guide .

  • cooldown (Optional[str]) – The duration of the policy’s cooldown period, in seconds. When a cooldown period is specified here, it overrides the default cooldown period defined for the Auto Scaling group. 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 .

  • estimated_instance_warmup (Union[int, float, None]) – The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. If not provided, the default is to use the value from the default cooldown period for the Auto Scaling group. Valid only if the policy type is TargetTrackingScaling or StepScaling .

  • metric_aggregation_type (Optional[str]) – The aggregation type for the CloudWatch metrics. The valid values are Minimum , Maximum , and Average . If the aggregation type is null, the value is treated as Average . Valid only if the policy type is StepScaling .

  • 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 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 a MinAdjustmentMagnitude of 2, Amazon EC2 Auto Scaling scales out the group by 2 instances. Valid only if the policy type is StepScaling or SimpleScaling . 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 (Optional[str]) – One of the following policy types:. - TargetTrackingScaling - StepScaling - SimpleScaling (default) - PredictiveScaling For more information, see Target tracking scaling policies and Step and simple scaling policies in the Amazon EC2 Auto Scaling User Guide .

  • predictive_scaling_configuration (Union[IResolvable, PredictiveScalingConfigurationProperty, None]) – A predictive scaling policy. Includes support for predefined metrics only.

  • 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 positive value. Required if the policy type is SimpleScaling . (Not used with any other policy type.)

  • step_adjustments (Union[IResolvable, Sequence[Union[IResolvable, StepAdjustmentProperty]], None]) – 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 (Union[IResolvable, TargetTrackingConfigurationProperty, None]) – A target tracking scaling policy. Includes support for predefined or customized metrics. The following predefined metrics are available: - ASGAverageCPUUtilization - ASGAverageNetworkIn - ASGAverageNetworkOut - ALBRequestCountPerTarget If you specify ALBRequestCountPerTarget for the metric, you must specify the ResourceLabel property with the PredefinedMetricSpecification .

Methods

add_deletion_override(path)

Syntactic sugar for addOverride(path, undefined).

Parameters

path (str) – The path of the value to delete.

Return type

None

add_depends_on(target)

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.

Parameters

target (CfnResource) –

Return type

None

add_metadata(key, value)

Add a value to the CloudFormation Resource Metadata.

Parameters
  • key (str) –

  • value (Any) –

See

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

Return type

None

add_override(path, value)

Adds an override to the synthesized CloudFormation resource.

To add a property override, either use addPropertyOverride or prefix path with “Properties.” (i.e. Properties.TopicName).

If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.

For example:

cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"])
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")

would add the overrides Example:

"Properties": {
   "GlobalSecondaryIndexes": [
     {
       "Projection": {
         "NonKeyAttributes": [ "myattribute" ]
         ...
       }
       ...
     },
     {
       "ProjectionType": "INCLUDE"
       ...
     },
   ]
   ...
}
Parameters
  • path (str) –

    • The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.

  • value (Any) –

    • The value. Could be primitive or complex.

Return type

None

add_property_deletion_override(property_path)

Adds an override that deletes the value of a property from the resource definition.

Parameters

property_path (str) – The path to the property.

Return type

None

add_property_override(property_path, value)

Adds an override to a resource property.

Syntactic sugar for addOverride("Properties.<...>", value).

Parameters
  • property_path (str) – The path of the property.

  • value (Any) – The value.

Return type

None

apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)

Sets the deletion policy of the resource based on the removal policy specified.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters
  • policy (Optional[RemovalPolicy]) –

  • apply_to_update_replace_policy (Optional[bool]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: true

  • default (Optional[RemovalPolicy]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.

Return type

None

get_att(attribute_name)

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility in case there is no generated attribute.

Parameters

attribute_name (str) – The name of the attribute.

Return type

Reference

get_metadata(key)

Retrieve a value value from the CloudFormation Resource Metadata.

Parameters

key (str) –

See

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

Return type

Any

inspect(inspector)

Examines the CloudFormation resource and discloses attributes.

Parameters

inspector (TreeInspector) –

  • tree inspector to collect and process attributes.

Return type

None

override_logical_id(new_logical_id)

Overrides the auto-generated logical ID with a specific ID.

Parameters

new_logical_id (str) – The new logical ID to use for this stack element.

Return type

None

to_string()

Returns a string representation of this construct.

Return type

str

Returns

a string representation of this resource

Attributes

CFN_RESOURCE_TYPE_NAME = 'AWS::AutoScaling::ScalingPolicy'
adjustment_type

Specifies how the scaling adjustment is interpreted. The valid values are ChangeInCapacity , ExactCapacity , and PercentChangeInCapacity .

Required if the policy type is StepScaling or SimpleScaling . For more information, see Scaling adjustment types in the Amazon EC2 Auto Scaling User Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-as-scalingpolicy-adjustmenttype

Return type

Optional[str]

auto_scaling_group_name

The name of the Auto Scaling group.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-as-scalingpolicy-autoscalinggroupname

Return type

str

cfn_options

Options for this resource, such as condition, update policy etc.

Return type

ICfnResourceOptions

cfn_resource_type

AWS resource type.

Return type

str

cooldown

The duration of the policy’s cooldown period, in seconds.

When a cooldown period is specified here, it overrides the default cooldown period defined for the Auto Scaling group.

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 .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-as-scalingpolicy-cooldown

Return type

Optional[str]

creation_stack

return:

the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.

Return type

List[str]

estimated_instance_warmup

The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.

If not provided, the default is to use the value from the default cooldown period for the Auto Scaling group.

Valid only if the policy type is TargetTrackingScaling or StepScaling .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-as-scalingpolicy-estimatedinstancewarmup

Return type

Union[int, float, None]

logical_id

The logical ID for this CloudFormation stack element.

The logical ID of the element is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Return type

str

Returns

the logical ID as a stringified token. This value will only get resolved during synthesis.

metric_aggregation_type

The aggregation type for the CloudWatch metrics.

The valid values are Minimum , Maximum , and Average . If the aggregation type is null, the value is treated as Average .

Valid only if the policy type is StepScaling .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-as-scalingpolicy-metricaggregationtype

Return type

Optional[str]

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 a MinAdjustmentMagnitude of 2, Amazon EC2 Auto Scaling scales out the group by 2 instances.

Valid only if the policy type is StepScaling or SimpleScaling . 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.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-as-scalingpolicy-minadjustmentmagnitude

Return type

Union[int, float, None]

node

The construct tree node associated with this construct.

Return type

ConstructNode

policy_type

.

  • TargetTrackingScaling

  • StepScaling

  • SimpleScaling (default)

  • PredictiveScaling

For more information, see Target tracking scaling policies and Step and simple scaling policies in the Amazon EC2 Auto Scaling User Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-as-scalingpolicy-policytype

Type

One of the following policy types

Return type

Optional[str]

predictive_scaling_configuration

A predictive scaling policy.

Includes support for predefined metrics only.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-autoscaling-scalingpolicy-predictivescalingconfiguration

Return type

Union[IResolvable, PredictiveScalingConfigurationProperty, None]

ref

Return a string that will be resolved to a CloudFormation { Ref } for this element.

If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).

Return type

str

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 positive value.

Required if the policy type is SimpleScaling . (Not used with any other policy type.)

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-as-scalingpolicy-scalingadjustment

Return type

Union[int, float, None]

stack

The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).

Return type

Stack

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.)

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-as-scalingpolicy-stepadjustments

Return type

Union[IResolvable, List[Union[IResolvable, StepAdjustmentProperty]], None]

target_tracking_configuration

A target tracking scaling policy. Includes support for predefined or customized metrics.

The following predefined metrics are available:

  • ASGAverageCPUUtilization

  • ASGAverageNetworkIn

  • ASGAverageNetworkOut

  • ALBRequestCountPerTarget

If you specify ALBRequestCountPerTarget for the metric, you must specify the ResourceLabel property with the PredefinedMetricSpecification .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-autoscaling-scalingpolicy-targettrackingconfiguration

Return type

Union[IResolvable, TargetTrackingConfigurationProperty, None]

Static Methods

classmethod is_cfn_element(x)

Returns true if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of instanceof to allow stack elements from different versions of this library to be included in the same stack.

Parameters

x (Any) –

Return type

bool

Returns

The construct as a stack element or undefined if it is not a stack element.

classmethod is_cfn_resource(construct)

Check whether the given construct is a CfnResource.

Parameters

construct (IConstruct) –

Return type

bool

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool

CustomizedMetricSpecificationProperty

class CfnScalingPolicy.CustomizedMetricSpecificationProperty(*, metric_name, namespace, statistic, dimensions=None, unit=None)

Bases: object

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.

Parameters
  • metric_name (str) – 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 .

  • namespace (str) – The namespace of the metric.

  • statistic (str) – The statistic of the metric.

  • dimensions (Union[IResolvable, Sequence[Union[IResolvable, MetricDimensionProperty]], None]) – The dimensions of the metric. Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.

  • unit (Optional[str]) – 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 .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-customizedmetricspecification.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_autoscaling as autoscaling

customized_metric_specification_property = autoscaling.CfnScalingPolicy.CustomizedMetricSpecificationProperty(
    metric_name="metricName",
    namespace="namespace",
    statistic="statistic",

    # the properties below are optional
    dimensions=[autoscaling.CfnScalingPolicy.MetricDimensionProperty(
        name="name",
        value="value"
    )],
    unit="unit"
)

Attributes

dimensions

The dimensions of the metric.

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

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-customizedmetricspecification.html#cfn-autoscaling-scalingpolicy-customizedmetricspecification-dimensions

Return type

Union[IResolvable, List[Union[IResolvable, MetricDimensionProperty]], None]

metric_name

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 .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-customizedmetricspecification.html#cfn-autoscaling-scalingpolicy-customizedmetricspecification-metricname

Return type

str

namespace

The namespace of the metric.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-customizedmetricspecification.html#cfn-autoscaling-scalingpolicy-customizedmetricspecification-namespace

Return type

str

statistic

The statistic of the metric.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-customizedmetricspecification.html#cfn-autoscaling-scalingpolicy-customizedmetricspecification-statistic

Return type

str

unit

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 .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-customizedmetricspecification.html#cfn-autoscaling-scalingpolicy-customizedmetricspecification-unit

Return type

Optional[str]

MetricDimensionProperty

class CfnScalingPolicy.MetricDimensionProperty(*, name, value)

Bases: object

MetricDimension specifies a name/value pair that is part of the identity of a CloudWatch metric for the Dimensions property of the AWS::AutoScaling::ScalingPolicy CustomizedMetricSpecification property type. Duplicate dimensions are not allowed.

Parameters
  • name (str) – The name of the dimension.

  • value (str) – The value of the dimension.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-metricdimension.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_autoscaling as autoscaling

metric_dimension_property = autoscaling.CfnScalingPolicy.MetricDimensionProperty(
    name="name",
    value="value"
)

Attributes

name

The name of the dimension.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-metricdimension.html#cfn-autoscaling-scalingpolicy-metricdimension-name

Return type

str

value

The value of the dimension.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-metricdimension.html#cfn-autoscaling-scalingpolicy-metricdimension-value

Return type

str

PredefinedMetricSpecificationProperty

class CfnScalingPolicy.PredefinedMetricSpecificationProperty(*, predefined_metric_type, resource_label=None)

Bases: object

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

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

Parameters
  • predefined_metric_type (str) – The metric type. The following predefined metrics are available. - ASGAverageCPUUtilization - Average CPU utilization of the Auto Scaling group. - ASGAverageNetworkIn - Average number of bytes received on all network interfaces by the Auto Scaling group. - ASGAverageNetworkOut - Average number of bytes sent out on all network interfaces by the Auto Scaling group. - ALBRequestCountPerTarget - Number of requests completed per target in an Application Load Balancer target group.

  • resource_label (Optional[str]) – Identifies the resource associated with the metric type. You can’t specify a resource label unless the metric type is ALBRequestCountPerTarget and there is a target group attached to the Auto Scaling group. The format is app/ *load-balancer-name* / *load-balancer-id* /targetgroup/ *target-group-name* / *target-group-id* , where - app/ *load-balancer-name* / *load-balancer-id* is the final portion of the load balancer ARN, and - targetgroup/ *target-group-name* / *target-group-id* is the final portion of the target group ARN.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predefinedmetricspecification.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_autoscaling as autoscaling

predefined_metric_specification_property = autoscaling.CfnScalingPolicy.PredefinedMetricSpecificationProperty(
    predefined_metric_type="predefinedMetricType",

    # the properties below are optional
    resource_label="resourceLabel"
)

Attributes

predefined_metric_type

The metric type. The following predefined metrics are available.

  • ASGAverageCPUUtilization - Average CPU utilization of the Auto Scaling group.

  • ASGAverageNetworkIn - Average number of bytes received on all network interfaces by the Auto Scaling group.

  • ASGAverageNetworkOut - Average number of bytes sent out on all network interfaces by the Auto Scaling group.

  • ALBRequestCountPerTarget - Number of requests completed per target in an Application Load Balancer target group.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predefinedmetricspecification.html#cfn-autoscaling-scalingpolicy-predefinedmetricspecification-predefinedmetrictype

Return type

str

resource_label

Identifies the resource associated with the metric type.

You can’t specify a resource label unless the metric type is ALBRequestCountPerTarget and there is a target group attached to the Auto Scaling group.

The format is app/ *load-balancer-name* / *load-balancer-id* /targetgroup/ *target-group-name* / *target-group-id* , where

  • app/ *load-balancer-name* / *load-balancer-id* is the final portion of the load balancer ARN, and

  • targetgroup/ *target-group-name* / *target-group-id* is the final portion of the target group ARN.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predefinedmetricspecification.html#cfn-autoscaling-scalingpolicy-predefinedmetricspecification-resourcelabel

Return type

Optional[str]

PredictiveScalingConfigurationProperty

class CfnScalingPolicy.PredictiveScalingConfigurationProperty(*, metric_specifications, max_capacity_breach_behavior=None, max_capacity_buffer=None, mode=None, scheduling_buffer_time=None)

Bases: object

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 PutScalingPolicy in the Amazon EC2 Auto Scaling API Reference and Predictive scaling in the Amazon EC2 Auto Scaling User Guide .

Parameters
  • metric_specifications (Union[IResolvable, Sequence[Union[IResolvable, PredictiveScalingMetricSpecificationProperty]]]) – An array that contains information about the metrics and target utilization to use for predictive scaling. .. epigraph:: Adding more than one predictive scaling metric specification to the array is currently not supported.

  • max_capacity_breach_behavior (Optional[str]) – 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 cannot scale out capacity higher than the maximum capacity. The maximum capacity is enforced as a hard limit. - IncreaseMaxCapacity - Amazon EC2 Auto Scaling can scale out capacity higher than the maximum capacity 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 .

  • max_capacity_buffer (Union[int, float, None]) – 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.

  • mode (Optional[str]) – The predictive scaling mode. Defaults to ForecastOnly if not specified.

  • scheduling_buffer_time (Union[int, float, None]) – 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.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingconfiguration.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_autoscaling as autoscaling

predictive_scaling_configuration_property = autoscaling.CfnScalingPolicy.PredictiveScalingConfigurationProperty(
    metric_specifications=[autoscaling.CfnScalingPolicy.PredictiveScalingMetricSpecificationProperty(
        target_value=123,

        # the properties below are optional
        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
)

Attributes

max_capacity_breach_behavior

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 cannot scale out capacity higher than the maximum capacity. The maximum capacity is enforced as a hard limit.

  • IncreaseMaxCapacity - Amazon EC2 Auto Scaling can scale out capacity higher than the maximum capacity 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 .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingconfiguration.html#cfn-autoscaling-scalingpolicy-predictivescalingconfiguration-maxcapacitybreachbehavior

Return type

Optional[str]

max_capacity_buffer

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.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingconfiguration.html#cfn-autoscaling-scalingpolicy-predictivescalingconfiguration-maxcapacitybuffer

Return type

Union[int, float, None]

metric_specifications

An array that contains information about the metrics and target utilization to use for predictive scaling.

Adding more than one predictive scaling metric specification to the array is currently not supported.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingconfiguration.html#cfn-autoscaling-scalingpolicy-predictivescalingconfiguration-metricspecifications

Return type

Union[IResolvable, List[Union[IResolvable, PredictiveScalingMetricSpecificationProperty]]]

mode

The predictive scaling mode.

Defaults to ForecastOnly if not specified.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingconfiguration.html#cfn-autoscaling-scalingpolicy-predictivescalingconfiguration-mode

Return type

Optional[str]

scheduling_buffer_time

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.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingconfiguration.html#cfn-autoscaling-scalingpolicy-predictivescalingconfiguration-schedulingbuffertime

Return type

Union[int, float, None]

PredictiveScalingMetricSpecificationProperty

class CfnScalingPolicy.PredictiveScalingMetricSpecificationProperty(*, target_value, predefined_load_metric_specification=None, predefined_metric_pair_specification=None, predefined_scaling_metric_specification=None)

Bases: object

A structure that specifies a metric specification for the MetricSpecifications property of the AWS::AutoScaling::ScalingPolicy PredictiveScalingConfiguration property type.

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

Parameters
  • target_value (Union[int, float]) – Specifies the target utilization. .. epigraph:: Some metrics are based on a count instead of a percentage, such as the request count for an Application Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify the target utilization as the optimal average request or message count per instance during any one-minute interval.

  • predefined_load_metric_specification (Union[IResolvable, PredictiveScalingPredefinedLoadMetricProperty, None]) – The load metric specification. If you specify PredefinedMetricPairSpecification , don’t specify this property.

  • predefined_metric_pair_specification (Union[IResolvable, PredictiveScalingPredefinedMetricPairProperty, None]) – The metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate scaling metric and load metric to use. .. epigraph:: With predictive scaling, you must specify either a metric pair, or a load metric and a scaling metric individually. Specifying a metric pair instead of individual metrics provides a simpler way to configure metrics for a scaling policy. You choose the metric pair, and the policy automatically knows the correct sum and average statistics to use for the load metric and the scaling metric.

  • predefined_scaling_metric_specification (Union[IResolvable, PredictiveScalingPredefinedScalingMetricProperty, None]) – The scaling metric specification. If you specify PredefinedMetricPairSpecification , don’t specify this property.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingmetricspecification.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_autoscaling as autoscaling

predictive_scaling_metric_specification_property = autoscaling.CfnScalingPolicy.PredictiveScalingMetricSpecificationProperty(
    target_value=123,

    # the properties below are optional
    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"
    )
)

Attributes

predefined_load_metric_specification

The load metric specification.

If you specify PredefinedMetricPairSpecification , don’t specify this property.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingmetricspecification.html#cfn-autoscaling-scalingpolicy-predictivescalingmetricspecification-predefinedloadmetricspecification

Return type

Union[IResolvable, PredictiveScalingPredefinedLoadMetricProperty, None]

predefined_metric_pair_specification

The metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate scaling metric and load metric to use.

With predictive scaling, you must specify either a metric pair, or a load metric and a scaling metric individually. Specifying a metric pair instead of individual metrics provides a simpler way to configure metrics for a scaling policy. You choose the metric pair, and the policy automatically knows the correct sum and average statistics to use for the load metric and the scaling metric.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingmetricspecification.html#cfn-autoscaling-scalingpolicy-predictivescalingmetricspecification-predefinedmetricpairspecification

Return type

Union[IResolvable, PredictiveScalingPredefinedMetricPairProperty, None]

predefined_scaling_metric_specification

The scaling metric specification.

If you specify PredefinedMetricPairSpecification , don’t specify this property.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingmetricspecification.html#cfn-autoscaling-scalingpolicy-predictivescalingmetricspecification-predefinedscalingmetricspecification

Return type

Union[IResolvable, PredictiveScalingPredefinedScalingMetricProperty, None]

target_value

Specifies the target utilization.

Some metrics are based on a count instead of a percentage, such as the request count for an Application Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify the target utilization as the optimal average request or message count per instance during any one-minute interval.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingmetricspecification.html#cfn-autoscaling-scalingpolicy-predictivescalingmetricspecification-targetvalue

Return type

Union[int, float]

PredictiveScalingPredefinedLoadMetricProperty

class CfnScalingPolicy.PredictiveScalingPredefinedLoadMetricProperty(*, predefined_metric_type, resource_label=None)

Bases: object

Contains load metric information for the PredefinedLoadMetricSpecification property of the AWS::AutoScaling::ScalingPolicy PredictiveScalingMetricSpecification property type.

Does not apply to policies that use a metric pair for the metric specification.

Parameters
  • predefined_metric_type (str) – The metric type.

  • resource_label (Optional[str]) – A label that uniquely identifies a specific Application Load Balancer target group from which to determine the request count served by your Auto Scaling group. You can’t specify a resource label unless the target group is attached to the Auto Scaling group. You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is: app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff . Where: - app// is the final portion of the load balancer ARN - targetgroup// is the final portion of the target group ARN. To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingpredefinedloadmetric.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_autoscaling as autoscaling

predictive_scaling_predefined_load_metric_property = autoscaling.CfnScalingPolicy.PredictiveScalingPredefinedLoadMetricProperty(
    predefined_metric_type="predefinedMetricType",

    # the properties below are optional
    resource_label="resourceLabel"
)

Attributes

predefined_metric_type

The metric type.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingpredefinedloadmetric.html#cfn-autoscaling-scalingpolicy-predictivescalingpredefinedloadmetric-predefinedmetrictype

Return type

str

resource_label

A label that uniquely identifies a specific Application Load Balancer target group from which to determine the request count served by your Auto Scaling group.

You can’t specify a resource label unless the target group is attached to the Auto Scaling group.

You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is:

app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff .

Where:

  • app// is the final portion of the load balancer ARN

  • targetgroup// is the final portion of the target group ARN.

To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingpredefinedloadmetric.html#cfn-autoscaling-scalingpolicy-predictivescalingpredefinedloadmetric-resourcelabel

Return type

Optional[str]

PredictiveScalingPredefinedMetricPairProperty

class CfnScalingPolicy.PredictiveScalingPredefinedMetricPairProperty(*, predefined_metric_type, resource_label=None)

Bases: object

Contains metric pair information for the PredefinedMetricPairSpecification property of the AWS::AutoScaling::ScalingPolicy PredictiveScalingMetricSpecification property type.

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

Parameters
  • predefined_metric_type (str) – Indicates which metrics to use. There are two different types of metrics for each metric type: one is a load metric and one is a scaling metric. For example, if the metric type is ASGCPUUtilization , the Auto Scaling group’s total CPU metric is used as the load metric, and the average CPU metric is used for the scaling metric.

  • resource_label (Optional[str]) –

    A label that uniquely identifies a specific Application Load Balancer target group from which to determine the total and average request count served by your Auto Scaling group. You can’t specify a resource label unless the target group is attached to the Auto Scaling group. You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is: app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff . Where: - app// is the final portion of the load balancer ARN - targetgroup// is the final portion of the target group ARN. To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingpredefinedmetricpair.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_autoscaling as autoscaling

predictive_scaling_predefined_metric_pair_property = autoscaling.CfnScalingPolicy.PredictiveScalingPredefinedMetricPairProperty(
    predefined_metric_type="predefinedMetricType",

    # the properties below are optional
    resource_label="resourceLabel"
)

Attributes

predefined_metric_type

Indicates which metrics to use.

There are two different types of metrics for each metric type: one is a load metric and one is a scaling metric. For example, if the metric type is ASGCPUUtilization , the Auto Scaling group’s total CPU metric is used as the load metric, and the average CPU metric is used for the scaling metric.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingpredefinedmetricpair.html#cfn-autoscaling-scalingpolicy-predictivescalingpredefinedmetricpair-predefinedmetrictype

Return type

str

resource_label

A label that uniquely identifies a specific Application Load Balancer target group from which to determine the total and average request count served by your Auto Scaling group.

You can’t specify a resource label unless the target group is attached to the Auto Scaling group.

You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is:

app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff .

Where:

  • app// is the final portion of the load balancer ARN

  • targetgroup// is the final portion of the target group ARN.

To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingpredefinedmetricpair.html#cfn-autoscaling-scalingpolicy-predictivescalingpredefinedmetricpair-resourcelabel

Return type

Optional[str]

PredictiveScalingPredefinedScalingMetricProperty

class CfnScalingPolicy.PredictiveScalingPredefinedScalingMetricProperty(*, predefined_metric_type, resource_label=None)

Bases: object

Contains scaling metric information for the PredefinedScalingMetricSpecification property of the AWS::AutoScaling::ScalingPolicy PredictiveScalingMetricSpecification property type.

Does not apply to policies that use a metric pair for the metric specification.

Parameters
  • predefined_metric_type (str) – The metric type.

  • resource_label (Optional[str]) –

    A label that uniquely identifies a specific Application Load Balancer target group from which to determine the average request count served by your Auto Scaling group. You can’t specify a resource label unless the target group is attached to the Auto Scaling group. You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is: app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff . Where: - app// is the final portion of the load balancer ARN - targetgroup// is the final portion of the target group ARN. To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingpredefinedscalingmetric.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_autoscaling as autoscaling

predictive_scaling_predefined_scaling_metric_property = autoscaling.CfnScalingPolicy.PredictiveScalingPredefinedScalingMetricProperty(
    predefined_metric_type="predefinedMetricType",

    # the properties below are optional
    resource_label="resourceLabel"
)

Attributes

predefined_metric_type

The metric type.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingpredefinedscalingmetric.html#cfn-autoscaling-scalingpolicy-predictivescalingpredefinedscalingmetric-predefinedmetrictype

Return type

str

resource_label

A label that uniquely identifies a specific Application Load Balancer target group from which to determine the average request count served by your Auto Scaling group.

You can’t specify a resource label unless the target group is attached to the Auto Scaling group.

You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is:

app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff .

Where:

  • app// is the final portion of the load balancer ARN

  • targetgroup// is the final portion of the target group ARN.

To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingpredefinedscalingmetric.html#cfn-autoscaling-scalingpolicy-predictivescalingpredefinedscalingmetric-resourcelabel

Return type

Optional[str]

StepAdjustmentProperty

class CfnScalingPolicy.StepAdjustmentProperty(*, scaling_adjustment, metric_interval_lower_bound=None, metric_interval_upper_bound=None)

Bases: object

StepAdjustment specifies a step adjustment for the StepAdjustments property of the AWS::AutoScaling::ScalingPolicy resource.

For the following examples, suppose that you have an alarm with a breach threshold of 50:

  • To trigger a step adjustment when the metric is greater than or equal to 50 and less than 60, specify a lower bound of 0 and an upper bound of 10.

  • To trigger a step adjustment when the metric is greater than 40 and less than or equal to 50, specify a lower bound of -10 and an upper bound of 0.

There are a few rules for the step adjustments for your step policy:

  • The ranges of your step adjustments can’t overlap or have a gap.

  • At most one step adjustment can have a null lower bound. If one step adjustment has a negative lower bound, then there must be a step adjustment with a null lower bound.

  • At most one step adjustment can have a null upper bound. If one step adjustment has a positive upper bound, then there must be a step adjustment with a null upper bound.

  • The upper and lower bound can’t be null in the same step adjustment.

For more information, see Step adjustments in the Amazon EC2 Auto Scaling User Guide .

You can find a sample template snippet in the Examples section of the AWS::AutoScaling::ScalingPolicy documentation.

Parameters
  • scaling_adjustment (Union[int, float]) – The amount by which to scale. The adjustment is based on the value that you specified in the AdjustmentType property (either an absolute number or a percentage). A positive value adds to the current capacity and a negative number subtracts from the current capacity.

  • metric_interval_lower_bound (Union[int, float, None]) – The lower bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the lower bound is inclusive (the metric must be greater than or equal to the threshold plus the lower bound). Otherwise, it is exclusive (the metric must be greater than the threshold plus the lower bound). A null value indicates negative infinity.

  • metric_interval_upper_bound (Union[int, float, None]) – The upper bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the upper bound is exclusive (the metric must be less than the threshold plus the upper bound). Otherwise, it is inclusive (the metric must be less than or equal to the threshold plus the upper bound). A null value indicates positive infinity.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-stepadjustments.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_autoscaling as autoscaling

step_adjustment_property = autoscaling.CfnScalingPolicy.StepAdjustmentProperty(
    scaling_adjustment=123,

    # the properties below are optional
    metric_interval_lower_bound=123,
    metric_interval_upper_bound=123
)

Attributes

metric_interval_lower_bound

The lower bound for the difference between the alarm threshold and the CloudWatch metric.

If the metric value is above the breach threshold, the lower bound is inclusive (the metric must be greater than or equal to the threshold plus the lower bound). Otherwise, it is exclusive (the metric must be greater than the threshold plus the lower bound). A null value indicates negative infinity.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-stepadjustments.html#cfn-autoscaling-scalingpolicy-stepadjustment-metricintervallowerbound

Return type

Union[int, float, None]

metric_interval_upper_bound

The upper bound for the difference between the alarm threshold and the CloudWatch metric.

If the metric value is above the breach threshold, the upper bound is exclusive (the metric must be less than the threshold plus the upper bound). Otherwise, it is inclusive (the metric must be less than or equal to the threshold plus the upper bound). A null value indicates positive infinity.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-stepadjustments.html#cfn-autoscaling-scalingpolicy-stepadjustment-metricintervalupperbound

Return type

Union[int, float, None]

scaling_adjustment

The amount by which to scale.

The adjustment is based on the value that you specified in the AdjustmentType property (either an absolute number or a percentage). A positive value adds to the current capacity and a negative number subtracts from the current capacity.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-stepadjustments.html#cfn-autoscaling-scalingpolicy-stepadjustment-scalingadjustment

Return type

Union[int, float]

TargetTrackingConfigurationProperty

class CfnScalingPolicy.TargetTrackingConfigurationProperty(*, target_value, customized_metric_specification=None, disable_scale_in=None, predefined_metric_specification=None)

Bases: object

TargetTrackingConfiguration is a property of the AWS::AutoScaling::ScalingPolicy resource that specifies a target tracking scaling policy configuration for Amazon EC2 Auto Scaling.

For more information, see PutScalingPolicy in the Amazon EC2 Auto Scaling API Reference . For more information about scaling policies, see Dynamic scaling in the Amazon EC2 Auto Scaling User Guide .

Parameters
  • target_value (Union[int, float]) – The target value for the metric.

  • customized_metric_specification (Union[IResolvable, CustomizedMetricSpecificationProperty, None]) – A customized metric. You must specify either a predefined metric or a customized metric.

  • disable_scale_in (Union[bool, IResolvable, None]) – Indicates whether scaling in by the target tracking scaling policy is disabled. If scaling in is disabled, the target tracking scaling policy doesn’t remove instances from the Auto Scaling group. Otherwise, the target tracking scaling policy can remove instances from the Auto Scaling group. The default is false .

  • predefined_metric_specification (Union[IResolvable, PredefinedMetricSpecificationProperty, None]) – A predefined metric. You must specify either a predefined metric or a customized metric.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-targettrackingconfiguration.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_autoscaling as autoscaling

target_tracking_configuration_property = autoscaling.CfnScalingPolicy.TargetTrackingConfigurationProperty(
    target_value=123,

    # the properties below are optional
    customized_metric_specification=autoscaling.CfnScalingPolicy.CustomizedMetricSpecificationProperty(
        metric_name="metricName",
        namespace="namespace",
        statistic="statistic",

        # the properties below are optional
        dimensions=[autoscaling.CfnScalingPolicy.MetricDimensionProperty(
            name="name",
            value="value"
        )],
        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

customized_metric_specification

A customized metric.

You must specify either a predefined metric or a customized metric.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-targettrackingconfiguration.html#cfn-autoscaling-scalingpolicy-targettrackingconfiguration-customizedmetricspecification

Return type

Union[IResolvable, CustomizedMetricSpecificationProperty, None]

disable_scale_in

Indicates whether scaling in by the target tracking scaling policy is disabled.

If scaling in is disabled, the target tracking scaling policy doesn’t remove instances from the Auto Scaling group. Otherwise, the target tracking scaling policy can remove instances from the Auto Scaling group. The default is false .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-targettrackingconfiguration.html#cfn-autoscaling-scalingpolicy-targettrackingconfiguration-disablescalein

Return type

Union[bool, IResolvable, None]

predefined_metric_specification

A predefined metric.

You must specify either a predefined metric or a customized metric.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-targettrackingconfiguration.html#cfn-autoscaling-scalingpolicy-targettrackingconfiguration-predefinedmetricspecification

Return type

Union[IResolvable, PredefinedMetricSpecificationProperty, None]

target_value

The target value for the metric.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-targettrackingconfiguration.html#cfn-autoscaling-scalingpolicy-targettrackingconfiguration-targetvalue

Return type

Union[int, float]