MetricTargetTrackingProps

class aws_cdk.aws_autoscaling.MetricTargetTrackingProps(*, cooldown=None, disable_scale_in=None, estimated_instance_warmup=None, metric, target_value)

Bases: BaseTargetTrackingProps

Properties for enabling tracking of an arbitrary metric.

Parameters:
  • cooldown (Optional[Duration]) – Period after a scaling completes before another scaling activity can start. Default: - The default cooldown configured on the AutoScalingGroup.

  • disable_scale_in (Optional[bool]) – Indicates whether scale in by the target tracking policy is disabled. If the value is true, scale in is disabled and the target tracking policy won’t remove capacity from the autoscaling group. Otherwise, scale in is enabled and the target tracking policy can remove capacity from the group. Default: false

  • estimated_instance_warmup (Optional[Duration]) – Estimated time until a newly launched instance can send metrics to CloudWatch. Default: - Same as the cooldown.

  • metric (IMetric) – Metric to track. The metric must represent a utilization, so that if it’s higher than the target value, your ASG should scale out, and if it’s lower it should scale in.

  • target_value (Union[int, float]) – Value to keep the metric around.

ExampleMetadata:

fixture=_generated

Example:

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

# metric: cloudwatch.Metric

metric_target_tracking_props = autoscaling.MetricTargetTrackingProps(
    metric=metric,
    target_value=123,

    # the properties below are optional
    cooldown=cdk.Duration.minutes(30),
    disable_scale_in=False,
    estimated_instance_warmup=cdk.Duration.minutes(30)
)

Attributes

cooldown

Period after a scaling completes before another scaling activity can start.

Default:
  • The default cooldown configured on the AutoScalingGroup.

disable_scale_in

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

If the value is true, scale in is disabled and the target tracking policy won’t remove capacity from the autoscaling group. Otherwise, scale in is enabled and the target tracking policy can remove capacity from the group.

Default:

false

estimated_instance_warmup

Estimated time until a newly launched instance can send metrics to CloudWatch.

Default:
  • Same as the cooldown.

metric

Metric to track.

The metric must represent a utilization, so that if it’s higher than the target value, your ASG should scale out, and if it’s lower it should scale in.

target_value

Value to keep the metric around.