TargetTrackingScalingPolicyProps Struct
Properties for a concrete TargetTrackingPolicy.
Adds the scalingTarget.
Example
// 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_applicationautoscaling as appscaling } from 'aws-cdk-lib';
import { aws_cloudwatch as cloudwatch } from 'aws-cdk-lib';
import { aws_applicationautoscaling as interfaces_applicationautoscaling } from 'aws-cdk-lib/interfaces';
declare const metric: cloudwatch.Metric;
declare const scalableTargetRef: interfaces_applicationautoscaling.IScalableTargetRef;
const targetTrackingScalingPolicyProps: appscaling.TargetTrackingScalingPolicyProps = {
scalingTarget: scalableTargetRef,
targetValue: 123,
// the properties below are optional
customMetric: metric,
disableScaleIn: false,
policyName: 'policyName',
predefinedMetric: appscaling.PredefinedMetric.APPSTREAM_AVERAGE_CAPACITY_UTILIZATION,
resourceLabel: 'resourceLabel',
scaleInCooldown: cdk.Duration.minutes(30),
scaleOutCooldown: cdk.Duration.minutes(30),
};
Properties
customMetricIMetriccustom_metricIMetriccustomMetricIMetricCustomMetricIMetricCustomMetricIMetric= 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.
The metric must be in the same account and region as the scaling policy.
Exactly one of customMetric or predefinedMetric must be specified.
disableScaleInbooleandisable_scale_inbooldisableScaleInBooleanDisableScaleInboolDisableScaleIn*bool= false#If the value is true, scale in is disabled and the target tracking policy won't remove capacity from the scalable resource. Otherwise, scale in is enabled and the target tracking policy can remove capacity from the scalable resource.
policyNamestringpolicy_namestrpolicyNameStringPolicyNamestringPolicyName*string= Automatically generated name.#predefinedMetricPredefinedMetricpredefined_metricPredefinedMetricpredefinedMetricPredefinedMetricPredefinedMetricPredefinedMetricPredefinedMetricPredefinedMetric= No predefined metrics.#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.
resourceLabelstringresource_labelstrresourceLabelStringResourceLabelstringResourceLabel*string= No resource label.#Only used for predefined metric ALBRequestCountPerTarget.
Example value: app/<load-balancer-name>/<load-balancer-id>/targetgroup/<target-group-name>/<target-group-id>
scaleInCooldownDurationscale_in_cooldownDurationscaleInCooldownDurationScaleInCooldownDurationScaleInCooldownDuration= Duration.seconds(300) for the fo…#default
Default: Duration.seconds(300) for the following scalable targets: ECS services, Spot Fleet requests, EMR clusters, AppStream 2.0 fleets, Aurora DB clusters, Amazon SageMaker endpoint variants, Custom resources. For all other scalable targets, the default value is Duration.seconds(0): DynamoDB tables, DynamoDB global secondary indexes, Amazon Comprehend document classification endpoints, Lambda provisioned concurrency
scaleOutCooldownDurationscale_out_cooldownDurationscaleOutCooldownDurationScaleOutCooldownDurationScaleOutCooldownDuration= Duration.seconds(300) for the fo…#default
Default: Duration.seconds(300) for the following scalable targets: ECS services, Spot Fleet requests, EMR clusters, AppStream 2.0 fleets, Aurora DB clusters, Amazon SageMaker endpoint variants, Custom resources. For all other scalable targets, the default value is Duration.seconds(0): DynamoDB tables, DynamoDB global secondary indexes, Amazon Comprehend document classification endpoints, Lambda provisioned concurrency
scalingTargetIScalableTargetRefscaling_targetIScalableTargetRefscalingTargetIScalableTargetRefScalingTargetIScalableTargetRefScalingTargetIScalableTargetRefrequired#targetValuenumbertarget_valueint | floattargetValueNumberTargetValuedoubleTargetValue*float64required#