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: CfnResource

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 .

See:

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

CloudformationResource:

AWS::AutoScaling::ScalingPolicy

ExampleMetadata:

fixture=_generated

Example:

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

cfn_scaling_policy = 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(
            dimensions=[autoscaling.CfnScalingPolicy.MetricDimensionProperty(
                name="name",
                value="value"
            )],
            metric_name="metricName",
            metrics=[autoscaling.CfnScalingPolicy.TargetTrackingMetricDataQueryProperty(
                id="id",

                # the properties below are optional
                expression="expression",
                label="label",
                metric_stat=autoscaling.CfnScalingPolicy.TargetTrackingMetricStatProperty(
                    metric=autoscaling.CfnScalingPolicy.MetricProperty(
                        metric_name="metricName",
                        namespace="namespace",

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

                    # the properties below are optional
                    period=123,
                    unit="unit"
                ),
                period=123,
                return_data=False
            )],
            namespace="namespace",
            period=123,
            statistic="statistic",
            unit="unit"
        ),
        disable_scale_in=False,
        predefined_metric_specification=autoscaling.CfnScalingPolicy.PredefinedMetricSpecificationProperty(
            predefined_metric_type="predefinedMetricType",

            # the properties below are optional
            resource_label="resourceLabel"
        )
    )
)
Parameters:
  • scope (Construct) – Scope in which this resource is defined.

  • id (str) – Construct identifier for this resource (unique in its scope).

  • 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, Dict[str, Any], None]) – A predictive scaling policy. Provides support for predefined and custom metrics. Predefined metrics include CPU utilization, network in/out, and the Application Load Balancer request count. Required if the policy type 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 non-negative value. Required if the policy type is SimpleScaling . (Not used with any other policy type.)

  • step_adjustments (Union[IResolvable, Sequence[Union[IResolvable, StepAdjustmentProperty, Dict[str, Any]]], None]) – A set of adjustments that enable you to scale based on the size of the alarm breach. Required if the policy type is StepScaling . (Not used with any other policy type.)

  • target_tracking_configuration (Union[IResolvable, TargetTrackingConfigurationProperty, Dict[str, Any], None]) – A target tracking scaling policy. Provides support for predefined or custom metrics. The following predefined metrics are available: - ASGAverageCPUUtilization - ASGAverageNetworkIn - ASGAverageNetworkOut - ALBRequestCountPerTarget If you 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_dependency(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_depends_on(target)

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

Parameters:

target (CfnResource) –

Deprecated:

use addDependency

Stability:

deprecated

Return type:

None

add_metadata(key, value)

Add a value to the CloudFormation Resource Metadata.

Parameters:
  • key (str) –

  • value (Any) –

See:

Return type:

None

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.

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 intermediate 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). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT). A list of resources that support this policy can be found in the following link:

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 resource, please consult that specific resource’s documentation.

See:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options

Return type:

None

get_att(attribute_name, type_hint=None)

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.

  • type_hint (Optional[ResolutionTypeHint]) –

Return type:

Reference

get_metadata(key)

Retrieve a value value from the CloudFormation Resource Metadata.

Parameters:

key (str) –

See:

Return type:

Any

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.

inspect(inspector)

Examines the CloudFormation resource and discloses attributes.

Parameters:

inspector (TreeInspector) – tree inspector to collect and process attributes.

Return type:

None

obtain_dependencies()

Retrieves an array of resources this resource depends on.

This assembles dependencies on resources across stacks (including nested stacks) automatically.

Return type:

List[Union[Stack, CfnResource]]

obtain_resource_dependencies()

Get a shallow copy of dependencies between this resource and other resources in the same stack.

Return type:

List[CfnResource]

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

remove_dependency(target)

Indicates that this resource no longer depends on another resource.

This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.

Parameters:

target (CfnResource) –

Return type:

None

replace_dependency(target, new_target)

Replaces one dependency with another.

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

attr_arn

Returns the ARN of a scaling policy.

CloudformationAttribute:

Arn

attr_policy_name

Returns the name of a scaling policy.

CloudformationAttribute:

PolicyName

auto_scaling_group_name

The name of the Auto Scaling group.

cfn_options

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

cfn_resource_type

AWS resource type.

cooldown

A cooldown period, in seconds, that applies to a specific simple scaling policy.

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.

estimated_instance_warmup

Not needed if the default instance warmup is defined for the group..

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

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.

min_adjustment_magnitude

The minimum value to scale by when the adjustment type is PercentChangeInCapacity .

node

The tree node.

policy_type

.

Type:

One of the following policy types

predictive_scaling_configuration

A predictive scaling policy.

Provides support for predefined and custom metrics.

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

scaling_adjustment

The amount by which to scale, based on the specified adjustment type.

stack

The stack in which this element is defined.

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

step_adjustments

A set of adjustments that enable you to scale based on the size of the alarm breach.

target_tracking_configuration

A target tracking scaling policy.

Provides support for predefined or custom metrics.

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(x)

Check whether the given object is a CfnResource.

Parameters:

x (Any) –

Return type:

bool

classmethod is_construct(x)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.

CustomizedMetricSpecificationProperty

class CfnScalingPolicy.CustomizedMetricSpecificationProperty(*, dimensions=None, metric_name=None, metrics=None, namespace=None, period=None, statistic=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:
  • dimensions (Union[IResolvable, Sequence[Union[IResolvable, MetricDimensionProperty, Dict[str, Any]]], None]) – The dimensions of the metric. Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.

  • metric_name (Optional[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 .

  • metrics (Union[IResolvable, Sequence[Union[IResolvable, TargetTrackingMetricDataQueryProperty, Dict[str, Any]]], None]) – The metrics to include in the target tracking scaling policy, as a metric data query. This can include both raw metric and metric math expressions.

  • namespace (Optional[str]) – The namespace of the metric.

  • period (Union[int, float, None]) –

  • statistic (Optional[str]) – The statistic of the metric.

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

See:

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.
from aws_cdk import aws_autoscaling as autoscaling

customized_metric_specification_property = autoscaling.CfnScalingPolicy.CustomizedMetricSpecificationProperty(
    dimensions=[autoscaling.CfnScalingPolicy.MetricDimensionProperty(
        name="name",
        value="value"
    )],
    metric_name="metricName",
    metrics=[autoscaling.CfnScalingPolicy.TargetTrackingMetricDataQueryProperty(
        id="id",

        # the properties below are optional
        expression="expression",
        label="label",
        metric_stat=autoscaling.CfnScalingPolicy.TargetTrackingMetricStatProperty(
            metric=autoscaling.CfnScalingPolicy.MetricProperty(
                metric_name="metricName",
                namespace="namespace",

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

            # the properties below are optional
            period=123,
            unit="unit"
        ),
        period=123,
        return_data=False
    )],
    namespace="namespace",
    period=123,
    statistic="statistic",
    unit="unit"
)

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.

See:

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

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 .

See:

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

metrics

The metrics to include in the target tracking scaling policy, as a metric data query.

This can include both raw metric and metric math expressions.

See:

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

namespace

The namespace of the metric.

See:

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

period

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

Type:

see

statistic

The statistic of the metric.

See:

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

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 .

See:

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

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, Dict[str, Any], 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 ).

See:

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.
from aws_cdk import 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.

See:

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

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.

See:

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

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.

See:

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

metric_stat

Information about the metric data to return.

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

See:

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

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

See:

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

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.

See:

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.
from aws_cdk import aws_autoscaling as autoscaling

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

Attributes

name

The name of the dimension.

See:

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

value

The value of the dimension.

See:

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

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:
See:

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.
from aws_cdk import 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.

See:

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

metric_name

The name of the metric.

See:

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

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 .

See:

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

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 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, Dict[str, Any]]) –

    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 .

See:

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.
from aws_cdk import 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 .

See:

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

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 .

See:

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

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 .

See:

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

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.

See:

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.
from aws_cdk import 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.

See:

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

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.

See:

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

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, Dict[str, Any]]]]) – 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 can’t increase the maximum capacity of the group when the forecast capacity is close to or exceeds the maximum capacity. - IncreaseMaxCapacity - Amazon EC2 Auto Scaling can increase the maximum capacity of the group when the forecast capacity is close to or exceeds the maximum capacity. The upper limit is determined by the forecasted capacity and the value for MaxCapacityBuffer . .. epigraph:: Use caution when allowing the maximum capacity to be automatically increased. This can lead to more instances being launched than intended if the increased maximum capacity is not monitored and managed. The increased maximum capacity then becomes the new normal maximum capacity for the Auto Scaling group until you manually update it. The maximum capacity does not automatically decrease back to the original maximum.

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

See:

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.
from aws_cdk import 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 can’t increase the maximum capacity of the group when the forecast capacity is close to or exceeds the maximum capacity.

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

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

See:

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

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.

See:

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

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.

See:

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

mode

The predictive scaling mode.

Defaults to ForecastOnly if not specified.

See:

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

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.

See:

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

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, Dict[str, Any]]]]) – 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.

See:

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.
from aws_cdk import 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.

See:

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

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, Dict[str, Any]]]]) – 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.

See:

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.
from aws_cdk import 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.

See:

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

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, Dict[str, Any]]]]) – 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.

See:

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.
from aws_cdk import 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.

See:

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

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:
See:

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.
from aws_cdk import 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.

See:

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

customized_load_metric_specification

The customized load metric specification.

See:

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

customized_scaling_metric_specification

The customized scaling metric specification.

See:

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

predefined_load_metric_specification

The predefined load metric specification.

See:

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

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.

See:

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

predefined_scaling_metric_specification

The predefined scaling metric specification.

See:

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

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.

See:

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

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.

See:

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.
from aws_cdk import 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.

See:

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

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.

See:

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

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.

See:

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.
from aws_cdk import 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.

See:

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

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.

See:

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

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.

See:

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.
from aws_cdk import 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.

See:

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

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.

See:

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

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. For exact capacity, you must specify a non-negative value.

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

See:

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

ExampleMetadata:

fixture=_generated

Example:

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

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.

See:

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

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.

See:

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

scaling_adjustment

The amount by which to scale, based on the specified adjustment type.

A positive value adds to the current capacity while a negative number removes from the current capacity. For exact capacity, you must specify a non-negative value.

See:

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

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, Dict[str, Any], 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, Dict[str, Any], None]) – A predefined metric. You must specify either a predefined metric or a customized metric.

See:

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.
from aws_cdk import 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(
        dimensions=[autoscaling.CfnScalingPolicy.MetricDimensionProperty(
            name="name",
            value="value"
        )],
        metric_name="metricName",
        metrics=[autoscaling.CfnScalingPolicy.TargetTrackingMetricDataQueryProperty(
            id="id",

            # the properties below are optional
            expression="expression",
            label="label",
            metric_stat=autoscaling.CfnScalingPolicy.TargetTrackingMetricStatProperty(
                metric=autoscaling.CfnScalingPolicy.MetricProperty(
                    metric_name="metricName",
                    namespace="namespace",

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

                # the properties below are optional
                period=123,
                unit="unit"
            ),
            period=123,
            return_data=False
        )],
        namespace="namespace",
        period=123,
        statistic="statistic",
        unit="unit"
    ),
    disable_scale_in=False,
    predefined_metric_specification=autoscaling.CfnScalingPolicy.PredefinedMetricSpecificationProperty(
        predefined_metric_type="predefinedMetricType",

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

Attributes

customized_metric_specification

A customized metric.

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

See:

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

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 .

See:

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

predefined_metric_specification

A predefined metric.

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

See:

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

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.

See:

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

TargetTrackingMetricDataQueryProperty

class CfnScalingPolicy.TargetTrackingMetricDataQueryProperty(*, id, expression=None, label=None, metric_stat=None, period=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.

You can use TargetTrackingMetricDataQuery structures with a PutScalingPolicy operation when you specify a TargetTrackingConfiguration in the request.

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, see the Create a target tracking scaling policy for Amazon EC2 Auto Scaling using metric math 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 TargetTrackingMetricDataQuery 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 TargetTrackingMetricDataQuery 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, TargetTrackingMetricStatProperty, Dict[str, Any], None]) – Information about the metric data to return. Conditional: Within each TargetTrackingMetricDataQuery object, you must specify either Expression or MetricStat , but not both.

  • period (Union[int, float, None]) –

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

See:

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

ExampleMetadata:

fixture=_generated

Example:

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

target_tracking_metric_data_query_property = autoscaling.CfnScalingPolicy.TargetTrackingMetricDataQueryProperty(
    id="id",

    # the properties below are optional
    expression="expression",
    label="label",
    metric_stat=autoscaling.CfnScalingPolicy.TargetTrackingMetricStatProperty(
        metric=autoscaling.CfnScalingPolicy.MetricProperty(
            metric_name="metricName",
            namespace="namespace",

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

        # the properties below are optional
        period=123,
        unit="unit"
    ),
    period=123,
    return_data=False
)

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 TargetTrackingMetricDataQuery object, you must specify either Expression or MetricStat , but not both.

See:

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

id

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

This name must be unique among all TargetTrackingMetricDataQuery 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.

See:

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

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.

See:

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

metric_stat

Information about the metric data to return.

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

See:

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

period

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

Type:

see

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

See:

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

TargetTrackingMetricStatProperty

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

Bases: object

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

TargetTrackingMetricStat is a property of the TargetTrackingMetricDataQuery object.

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

Parameters:
  • metric (Union[IResolvable, MetricProperty, Dict[str, Any]]) – The metric to use.

  • 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 metric for scaling is Average .

  • period (Union[int, float, None]) –

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

See:

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

ExampleMetadata:

fixture=_generated

Example:

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

target_tracking_metric_stat_property = autoscaling.CfnScalingPolicy.TargetTrackingMetricStatProperty(
    metric=autoscaling.CfnScalingPolicy.MetricProperty(
        metric_name="metricName",
        namespace="namespace",

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

    # the properties below are optional
    period=123,
    unit="unit"
)

Attributes

metric

The metric to use.

See:

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

period

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

Type:

see

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 metric for scaling is Average .

See:

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

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 .

See:

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