Skip to content
v2.275.0

TargetTrackingScalingPolicyProps Struct ​

Properties for a concrete TargetTrackingPolicy.

Adds the scalingTarget.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_autoscaling as autoscaling } from 'aws-cdk-lib';
import { aws_cloudwatch as cloudwatch } from 'aws-cdk-lib';
import { aws_autoscaling as interfaces_autoscaling } from 'aws-cdk-lib/interfaces';

declare const autoScalingGroupRef: interfaces_autoscaling.IAutoScalingGroupRef;
declare const metric: cloudwatch.Metric;
const targetTrackingScalingPolicyProps: autoscaling.TargetTrackingScalingPolicyProps = {
  autoScalingGroup: autoScalingGroupRef,
  targetValue: 123,

  // the properties below are optional
  cooldown: cdk.Duration.minutes(30),
  customMetric: metric,
  disableScaleIn: false,
  estimatedInstanceWarmup: cdk.Duration.minutes(30),
  predefinedMetric: autoscaling.PredefinedMetric.ASG_AVERAGE_CPU_UTILIZATION,
  resourceLabel: 'resourceLabel',
};

Properties ​

autoScalingGroupIAutoScalingGroupRefauto_scaling_groupIAutoScalingGroupRefautoScalingGroupIAutoScalingGroupRefAutoScalingGroupIAutoScalingGroupRefAutoScalingGroupIAutoScalingGroupRefrequired#
cooldownoptionalDurationcooldownoptionalDurationcooldownoptionalDurationCooldownoptionalDurationCooldownoptionalDuration#
Period after a scaling completes before another scaling activity can start.

Default: The default cooldown configured on the AutoScalingGroup.

customMetricoptionalIMetriccustom_metricoptionalIMetriccustomMetricoptionalIMetricCustomMetricoptionalIMetricCustomMetricoptionalIMetric#
A custom metric for application autoscaling.

Default: No custom metric.

notes

The metric must track utilization. Scaling out will happen if the metric is higher than the target value, scaling in will happen in the metric is lower than the target value.

Exactly one of customMetric or predefinedMetric must be specified.

disableScaleInoptionalbooleandisable_scale_inoptionalbooldisableScaleInoptionalBooleanDisableScaleInoptionalboolDisableScaleInoptional*bool= false#
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.

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

Default: Same as the cooldown.

predefinedMetricoptionalPredefinedMetricpredefined_metricoptionalPredefinedMetricpredefinedMetricoptionalPredefinedMetricPredefinedMetricoptionalPredefinedMetricPredefinedMetricoptionalPredefinedMetric#
A predefined metric for application autoscaling.

Default: No predefined metric.

notes

The metric must track utilization. Scaling out will happen if the metric is higher than the target value, scaling in will happen in the metric is lower than the target value.

Exactly one of customMetric or predefinedMetric must be specified.

resourceLabeloptionalstringresource_labeloptionalstrresourceLabeloptionalStringResourceLabeloptionalstringResourceLabeloptional*string#
The resource label associated with the predefined metric.

Default: No resource label.

Should be supplied if the predefined metric is ALBRequestCountPerTarget, and the format should be:

app/<load-balancer-name>/<load-balancer-id>/targetgroup/<target-group-name>/<target-group-id>

targetValuenumbertarget_valueint | floattargetValueNumberTargetValuedoubleTargetValue*float64required#
The target value for the metric.