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
            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(
            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 (for example, an absolute number or a percentage). 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]) – 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 (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 is TargetTrackingScaling or StepScaling . .. 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 (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

  • predictive_scaling_configuration (Union[IResolvable, PredictiveScalingConfigurationProperty, 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 is PredictiveScaling .

  • 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. 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 the ResourceLabel property with the PredefinedMetricSpecification . Required if the policy type is TargetTrackingScaling .

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"
       ...
     },
   ]
   ...
}

The value argument to addOverride will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.

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 (for example, an absolute number or a percentage).

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

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

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

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 or StepScaling . .. 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.
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

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

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. 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 the ResourceLabel property with the PredefinedMetricSpecification .

Required if the policy type is TargetTrackingScaling .

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]

MetricDataQueryProperty

class CfnScalingPolicy.MetricDataQueryProperty(*, id, expression=None, label=None, metric_stat=None, return_data=None)

Bases: object

The metric data to return.

Also defines whether this call is returning data for one metric only, or whether it is performing a math expression on the values of returned metric statistics to create a new time series. A time series is a series of data points, each of which is associated with a timestamp.

MetricDataQuery is a property of the following property types:

Predictive scaling uses the time series data received from CloudWatch to understand how to schedule capacity based on your historical workload patterns.

You can call for a single metric or perform math expressions on multiple metrics. Any expressions used in a metric specification must eventually return a single time series.

For more information and examples, see Advanced predictive scaling policy configurations using custom metrics in the Amazon EC2 Auto Scaling User Guide .

Parameters
  • id (str) – A short name that identifies the object’s results in the response. This name must be unique among all MetricDataQuery objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.

  • expression (Optional[str]) – The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the Id of the other metrics to refer to those metrics, and can also use the Id of other expressions to use the result of those expressions. Conditional: Within each MetricDataQuery object, you must specify either Expression or MetricStat , but not both.

  • label (Optional[str]) – A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.

  • metric_stat (Union[IResolvable, MetricStatProperty, None]) – Information about the metric data to return. Conditional: Within each MetricDataQuery object, you must specify either Expression or MetricStat , but not both.

  • return_data (Union[bool, IResolvable, None]) – Indicates whether to return the timestamps and raw data values of this metric. If you use any math expressions, specify true for this value for only the final math expression that the metric specification is based on. You must specify false for ReturnData for all the other metrics and expressions used in the metric specification. If you are only retrieving metrics and not performing any math expressions, do not specify anything for ReturnData . This sets it to its default ( true ).

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-metricdataquery.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_data_query_property = 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
)

Attributes

expression

The math expression to perform on the returned data, if this object is performing a math expression.

This expression can use the Id of the other metrics to refer to those metrics, and can also use the Id of other expressions to use the result of those expressions.

Conditional: Within each MetricDataQuery object, you must specify either Expression or MetricStat , but not both.

Link

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

Return type

Optional[str]

id

A short name that identifies the object’s results in the response.

This name must be unique among all MetricDataQuery objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.

Link

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

Return type

str

label

A human-readable label for this metric or expression.

This is especially useful if this is a math expression, so that you know what the value represents.

Link

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

Return type

Optional[str]

metric_stat

Information about the metric data to return.

Conditional: Within each MetricDataQuery object, you must specify either Expression or MetricStat , but not both.

Link

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

Return type

Union[IResolvable, MetricStatProperty, None]

return_data

Indicates whether to return the timestamps and raw data values of this metric.

If you use any math expressions, specify true for this value for only the final math expression that the metric specification is based on. You must specify false for ReturnData for all the other metrics and expressions used in the metric specification.

If you are only retrieving metrics and not performing any math expressions, do not specify anything for ReturnData . This sets it to its default ( true ).

Link

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

Return type

Union[bool, IResolvable, None]

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

MetricProperty

class CfnScalingPolicy.MetricProperty(*, metric_name, namespace, dimensions=None)

Bases: object

Represents a specific metric.

Metric is a property of the AWS::AutoScaling::ScalingPolicy MetricStat property type.

Parameters
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-metric.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_property = autoscaling.CfnScalingPolicy.MetricProperty(
    metric_name="metricName",
    namespace="namespace",

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

Attributes

dimensions

The dimensions for the metric.

For the list of available dimensions, see the AWS documentation available from the table in AWS services that publish CloudWatch metrics in the Amazon CloudWatch User Guide .

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-metric.html#cfn-autoscaling-scalingpolicy-metric-dimensions

Return type

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

metric_name

The name of the metric.

Link

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

Return type

str

namespace

The namespace of the metric.

For more information, see the table in AWS services that publish CloudWatch metrics in the Amazon CloudWatch User Guide .

Link

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

Return type

str

MetricStatProperty

class CfnScalingPolicy.MetricStatProperty(*, metric, stat, unit=None)

Bases: object

MetricStat is a property of the AWS::AutoScaling::ScalingPolicy MetricDataQuery property type.

This structure defines the CloudWatch metric to return, along with the statistic, period, and unit.

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

Parameters
  • metric (Union[IResolvable, MetricProperty]) –

    The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact metric name, namespace, and dimensions, inspect the Metric object that is returned by a call to ListMetrics .

  • stat (str) – The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide . The most commonly used metrics for predictive scaling are Average and Sum .

  • unit (Optional[str]) –

    The unit to use for the returned data points. 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-metricstat.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_stat_property = 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"
)

Attributes

metric

The CloudWatch metric to return, including the metric name, namespace, and dimensions.

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-metricstat.html#cfn-autoscaling-scalingpolicy-metricstat-metric

Return type

Union[IResolvable, MetricProperty]

stat

The statistic to return.

It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide .

The most commonly used metrics for predictive scaling are Average and Sum .

Link

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

Return type

str

unit

The unit to use for the returned data points.

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-metricstat.html#cfn-autoscaling-scalingpolicy-metricstat-unit

Return type

Optional[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 - Average Application Load Balancer request count per target for your Auto Scaling group.

  • 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-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

.

  • 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 - Average Application Load Balancer request count per target for your Auto Scaling group.

Link

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

Type

The metric type. The following predefined metrics are available

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

Parameters
  • metric_specifications (Union[IResolvable, Sequence[Union[IResolvable, PredictiveScalingMetricSpecificationProperty]]]) – 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.

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

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

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.

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]

PredictiveScalingCustomizedCapacityMetricProperty

class CfnScalingPolicy.PredictiveScalingCustomizedCapacityMetricProperty(*, metric_data_queries)

Bases: object

Contains capacity metric information for the CustomizedCapacityMetricSpecification property of the AWS::AutoScaling::ScalingPolicy PredictiveScalingMetricSpecification property type.

Parameters

metric_data_queries (Union[IResolvable, Sequence[Union[IResolvable, MetricDataQueryProperty]]]) – One or more metric data queries to provide the data points for a capacity metric. Use multiple metric data queries only if you are performing a math expression on returned data.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingcustomizedcapacitymetric.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_customized_capacity_metric_property = 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
    )]
)

Attributes

metric_data_queries

One or more metric data queries to provide the data points for a capacity metric.

Use multiple metric data queries only if you are performing a math expression on returned data.

Link

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

Return type

Union[IResolvable, List[Union[IResolvable, MetricDataQueryProperty]]]

PredictiveScalingCustomizedLoadMetricProperty

class CfnScalingPolicy.PredictiveScalingCustomizedLoadMetricProperty(*, metric_data_queries)

Bases: object

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

Parameters

metric_data_queries (Union[IResolvable, Sequence[Union[IResolvable, MetricDataQueryProperty]]]) – One or more metric data queries to provide the data points for a load metric. Use multiple metric data queries only if you are performing a math expression on returned data.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingcustomizedloadmetric.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_customized_load_metric_property = 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
    )]
)

Attributes

metric_data_queries

One or more metric data queries to provide the data points for a load metric.

Use multiple metric data queries only if you are performing a math expression on returned data.

Link

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

Return type

Union[IResolvable, List[Union[IResolvable, MetricDataQueryProperty]]]

PredictiveScalingCustomizedScalingMetricProperty

class CfnScalingPolicy.PredictiveScalingCustomizedScalingMetricProperty(*, metric_data_queries)

Bases: object

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

Parameters

metric_data_queries (Union[IResolvable, Sequence[Union[IResolvable, MetricDataQueryProperty]]]) – One or more metric data queries to provide the data points for a scaling metric. Use multiple metric data queries only if you are performing a math expression on returned data.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingcustomizedscalingmetric.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_customized_scaling_metric_property = 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
    )]
)

Attributes

metric_data_queries

One or more metric data queries to provide the data points for a scaling metric.

Use multiple metric data queries only if you are performing a math expression on returned data.

Link

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

Return type

Union[IResolvable, List[Union[IResolvable, MetricDataQueryProperty]]]

PredictiveScalingMetricSpecificationProperty

class CfnScalingPolicy.PredictiveScalingMetricSpecificationProperty(*, target_value, customized_capacity_metric_specification=None, customized_load_metric_specification=None, customized_scaling_metric_specification=None, 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.

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.

Example

  • You create a predictive scaling policy and specify ALBRequestCount as the value for the metric pair and 1000.0 as the target value. For this type of metric, you must provide the metric dimension for the corresponding target group, so you also provide a resource label for the Application Load Balancer target group that is attached to your Auto Scaling group.

  • The number of requests the target group receives per minute provides the load metric, and the request count averaged between the members of the target group provides the scaling metric. In CloudWatch, this refers to the RequestCount and RequestCountPerTarget metrics, respectively.

  • For optimal use of predictive scaling, you adhere to the best practice of using a dynamic scaling policy to automatically scale between the minimum capacity and maximum capacity in response to real-time changes in resource utilization.

  • Amazon EC2 Auto Scaling consumes data points for the load metric over the last 14 days and creates an hourly load forecast for predictive scaling. (A minimum of 24 hours of data is required.)

  • After creating the load forecast, Amazon EC2 Auto Scaling determines when to reduce or increase the capacity of your Auto Scaling group in each hour of the forecast period so that the average number of requests received by each instance is as close to 1000 requests per minute as possible at all times.

For information about using custom metrics with predictive scaling, see Advanced predictive scaling policy configurations using custom metrics in the Amazon EC2 Auto Scaling User Guide .

Parameters
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
    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"
    )
)

Attributes

customized_capacity_metric_specification

The customized capacity metric specification.

Link

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

Return type

Union[IResolvable, PredictiveScalingCustomizedCapacityMetricProperty, None]

customized_load_metric_specification

The customized load metric specification.

Link

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

Return type

Union[IResolvable, PredictiveScalingCustomizedLoadMetricProperty, None]

customized_scaling_metric_specification

The customized scaling metric specification.

Link

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

Return type

Union[IResolvable, PredictiveScalingCustomizedScalingMetricProperty, None]

predefined_load_metric_specification

The predefined load metric specification.

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 predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate scaling metric and load metric to use.

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 predefined scaling metric specification.

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

Parameters
  • scaling_adjustment (Union[int, float]) – 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. 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. The upper bound must be greater than the lower bound.

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.

The upper bound must be greater than the lower bound.

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, based on the specified adjustment type.

A positive value adds to the current capacity while a negative number removes from the current capacity.

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

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

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-targettrackingconfiguration.html#cfn-autoscaling-scalingpolicy-targettrackingconfiguration-targetvalue

Return type

Union[int, float]