Skip to content
v2.278.0

TargetTrackingScalingPolicyConfigurationProperty Struct ​

TargetTrackingScalingPolicyConfiguration is a property of the AWS::ApplicationAutoScaling::ScalingPolicy resource that specifies a target tracking scaling policy configuration for Application Auto Scaling. Use a target tracking scaling policy to adjust the capacity of the specified scalable target in response to actual workloads, so that resource utilization remains at or near the target utilization value.

For more information, see Target tracking scaling policies in the Application Auto Scaling User Guide .

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_applicationautoscaling as appscaling } from 'aws-cdk-lib';
const targetTrackingScalingPolicyConfigurationProperty: appscaling.CfnScalingPolicy.TargetTrackingScalingPolicyConfigurationProperty = {
  targetValue: 123,

  // the properties below are optional
  customizedMetricSpecification: {
    dimensions: [{
      name: 'name',
      value: 'value',
    }],
    metricName: 'metricName',
    metrics: [{
      expression: 'expression',
      id: 'id',
      label: 'label',
      metricStat: {
        metric: {
          dimensions: [{
            name: 'name',
            value: 'value',
          }],
          metricName: 'metricName',
          namespace: 'namespace',
        },
        stat: 'stat',
        unit: 'unit',
      },
      returnData: false,
    }],
    namespace: 'namespace',
    statistic: 'statistic',
    unit: 'unit',
  },
  disableScaleIn: false,
  predefinedMetricSpecification: {
    predefinedMetricType: 'predefinedMetricType',

    // the properties below are optional
    resourceLabel: 'resourceLabel',
  },
  scaleInCooldown: 123,
  scaleOutCooldown: 123,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_applicationautoscaling as appscaling

target_tracking_scaling_policy_configuration_property = appscaling.CfnScalingPolicy.TargetTrackingScalingPolicyConfigurationProperty(
    target_value=123,

    # the properties below are optional
    customized_metric_specification=appscaling.CfnScalingPolicy.CustomizedMetricSpecificationProperty(
        dimensions=[appscaling.CfnScalingPolicy.MetricDimensionProperty(
            name="name",
            value="value"
        )],
        metric_name="metricName",
        metrics=[appscaling.CfnScalingPolicy.TargetTrackingMetricDataQueryProperty(
            expression="expression",
            id="id",
            label="label",
            metric_stat=appscaling.CfnScalingPolicy.TargetTrackingMetricStatProperty(
                metric=appscaling.CfnScalingPolicy.TargetTrackingMetricProperty(
                    dimensions=[appscaling.CfnScalingPolicy.TargetTrackingMetricDimensionProperty(
                        name="name",
                        value="value"
                    )],
                    metric_name="metricName",
                    namespace="namespace"
                ),
                stat="stat",
                unit="unit"
            ),
            return_data=False
        )],
        namespace="namespace",
        statistic="statistic",
        unit="unit"
    ),
    disable_scale_in=False,
    predefined_metric_specification=appscaling.CfnScalingPolicy.PredefinedMetricSpecificationProperty(
        predefined_metric_type="predefinedMetricType",

        # the properties below are optional
        resource_label="resourceLabel"
    ),
    scale_in_cooldown=123,
    scale_out_cooldown=123
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.applicationautoscaling.*;

TargetTrackingScalingPolicyConfigurationProperty targetTrackingScalingPolicyConfigurationProperty = TargetTrackingScalingPolicyConfigurationProperty.builder()
        .targetValue(123)

        // the properties below are optional
        .customizedMetricSpecification(CustomizedMetricSpecificationProperty.builder()
                .dimensions(List.of(MetricDimensionProperty.builder()
                        .name("name")
                        .value("value")
                        .build()))
                .metricName("metricName")
                .metrics(List.of(TargetTrackingMetricDataQueryProperty.builder()
                        .expression("expression")
                        .id("id")
                        .label("label")
                        .metricStat(TargetTrackingMetricStatProperty.builder()
                                .metric(TargetTrackingMetricProperty.builder()
                                        .dimensions(List.of(TargetTrackingMetricDimensionProperty.builder()
                                                .name("name")
                                                .value("value")
                                                .build()))
                                        .metricName("metricName")
                                        .namespace("namespace")
                                        .build())
                                .stat("stat")
                                .unit("unit")
                                .build())
                        .returnData(false)
                        .build()))
                .namespace("namespace")
                .statistic("statistic")
                .unit("unit")
                .build())
        .disableScaleIn(false)
        .predefinedMetricSpecification(PredefinedMetricSpecificationProperty.builder()
                .predefinedMetricType("predefinedMetricType")

                // the properties below are optional
                .resourceLabel("resourceLabel")
                .build())
        .scaleInCooldown(123)
        .scaleOutCooldown(123)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ApplicationAutoScaling;

var targetTrackingScalingPolicyConfigurationProperty = new TargetTrackingScalingPolicyConfigurationProperty {
    TargetValue = 123,

    // the properties below are optional
    CustomizedMetricSpecification = new CustomizedMetricSpecificationProperty {
        Dimensions = new [] { new MetricDimensionProperty {
            Name = "name",
            Value = "value"
        } },
        MetricName = "metricName",
        Metrics = new [] { new TargetTrackingMetricDataQueryProperty {
            Expression = "expression",
            Id = "id",
            Label = "label",
            MetricStat = new TargetTrackingMetricStatProperty {
                Metric = new TargetTrackingMetricProperty {
                    Dimensions = new [] { new TargetTrackingMetricDimensionProperty {
                        Name = "name",
                        Value = "value"
                    } },
                    MetricName = "metricName",
                    Namespace = "namespace"
                },
                Stat = "stat",
                Unit = "unit"
            },
            ReturnData = false
        } },
        Namespace = "namespace",
        Statistic = "statistic",
        Unit = "unit"
    },
    DisableScaleIn = false,
    PredefinedMetricSpecification = new PredefinedMetricSpecificationProperty {
        PredefinedMetricType = "predefinedMetricType",

        // the properties below are optional
        ResourceLabel = "resourceLabel"
    },
    ScaleInCooldown = 123,
    ScaleOutCooldown = 123
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

targetTrackingScalingPolicyConfigurationProperty := &TargetTrackingScalingPolicyConfigurationProperty{
	TargetValue: jsii.Number(123),

	// the properties below are optional
	CustomizedMetricSpecification: &CustomizedMetricSpecificationProperty{
		Dimensions: []interface{}{
			&MetricDimensionProperty{
				Name: jsii.String("name"),
				Value: jsii.String("value"),
			},
		},
		MetricName: jsii.String("metricName"),
		Metrics: []interface{}{
			&TargetTrackingMetricDataQueryProperty{
				Expression: jsii.String("expression"),
				Id: jsii.String("id"),
				Label: jsii.String("label"),
				MetricStat: &TargetTrackingMetricStatProperty{
					Metric: &TargetTrackingMetricProperty{
						Dimensions: []interface{}{
							&TargetTrackingMetricDimensionProperty{
								Name: jsii.String("name"),
								Value: jsii.String("value"),
							},
						},
						MetricName: jsii.String("metricName"),
						Namespace: jsii.String("namespace"),
					},
					Stat: jsii.String("stat"),
					Unit: jsii.String("unit"),
				},
				ReturnData: jsii.Boolean(false),
			},
		},
		Namespace: jsii.String("namespace"),
		Statistic: jsii.String("statistic"),
		Unit: jsii.String("unit"),
	},
	DisableScaleIn: jsii.Boolean(false),
	PredefinedMetricSpecification: &PredefinedMetricSpecificationProperty{
		PredefinedMetricType: jsii.String("predefinedMetricType"),

		// the properties below are optional
		ResourceLabel: jsii.String("resourceLabel"),
	},
	ScaleInCooldown: jsii.Number(123),
	ScaleOutCooldown: jsii.Number(123),
}

Properties ​

customizedMetricSpecificationoptionalIResolvable | CfnScalingPolicy.CustomizedMetricSpecificationPropertycustomized_metric_specificationoptionaltyping.Union[IResolvable, CustomizedMetricSpecificationProperty]customizedMetricSpecificationoptionalIResolvableCustomizedMetricSpecificationoptionalIResolvableCustomizedMetricSpecificationoptionalinterface{} #
A customized metric.

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

disableScaleInoptionalboolean | IResolvabledisable_scale_inoptionaltyping.Union[bool, IResolvable]disableScaleInoptionalBooleanDisableScaleInoptionalboolDisableScaleInoptionalinterface{} #
Indicates whether scale in by the target tracking scaling policy is disabled.
notes

If the value is true , scale in is disabled and the target tracking scaling policy won't remove capacity from the scalable target. Otherwise, scale in is enabled and the target tracking scaling policy can remove capacity from the scalable target. The default value is false .

predefinedMetricSpecificationoptionalIResolvable | CfnScalingPolicy.PredefinedMetricSpecificationPropertypredefined_metric_specificationoptionaltyping.Union[IResolvable, PredefinedMetricSpecificationProperty]predefinedMetricSpecificationoptionalIResolvablePredefinedMetricSpecificationoptionalIResolvablePredefinedMetricSpecificationoptionalinterface{} #
A predefined metric.

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

scaleInCooldownoptionalnumberscale_in_cooldownoptionalint | floatscaleInCooldownoptionalNumberScaleInCooldownoptionaldoubleScaleInCooldownoptional*float64 #
The amount of time, in seconds, after a scale-in activity completes before another scale-in activity can start.
notes

For more information and for default values, see Define cooldown periods in the Application Auto Scaling User Guide .

scaleOutCooldownoptionalnumberscale_out_cooldownoptionalint | floatscaleOutCooldownoptionalNumberScaleOutCooldownoptionaldoubleScaleOutCooldownoptional*float64 #
The amount of time, in seconds, to wait for a previous scale-out activity to take effect.
notes

For more information and for default values, see Define cooldown periods in the Application Auto Scaling User Guide .

targetValuenumbertarget_valueint | floattargetValueNumberTargetValuedoubleTargetValue*float64 required #
The target value for the metric.
notes

Although this property accepts numbers of type Double, it won't accept values that are either too small or too large. Values must be in the range of -2^360 to 2^360. The value must be a valid number based on the choice of metric. For example, if the metric is CPU utilization, then the target value is a percent value that represents how much of the CPU can be used before scaling out.