TargetTrackingScalingPolicyProps Struct
Properties for a concrete TargetTrackingPolicy.
Adds the scalingTarget.
| Source | aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts |
|---|---|
| Type last changed |
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),
};
# 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_applicationautoscaling as appscaling
from aws_cdk import aws_cloudwatch as cloudwatch
from aws_cdk.interfaces import aws_applicationautoscaling as interfaces_applicationautoscaling
# metric: cloudwatch.Metric
# scalable_target_ref: interfaces_applicationautoscaling.IScalableTargetRef
target_tracking_scaling_policy_props = appscaling.TargetTrackingScalingPolicyProps(
scaling_target=scalable_target_ref,
target_value=123,
# the properties below are optional
custom_metric=metric,
disable_scale_in=False,
policy_name="policyName",
predefined_metric=appscaling.PredefinedMetric.APPSTREAM_AVERAGE_CAPACITY_UTILIZATION,
resource_label="resourceLabel",
scale_in_cooldown=cdk.Duration.minutes(30),
scale_out_cooldown=cdk.Duration.minutes(30)
)
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.applicationautoscaling.*;
import software.amazon.awscdk.services.cloudwatch.*;
import software.amazon.awscdk.interfaces.applicationautoscaling.*;
Metric metric;
IScalableTargetRef scalableTargetRef;
TargetTrackingScalingPolicyProps targetTrackingScalingPolicyProps = TargetTrackingScalingPolicyProps.builder()
.scalingTarget(scalableTargetRef)
.targetValue(123)
// the properties below are optional
.customMetric(metric)
.disableScaleIn(false)
.policyName("policyName")
.predefinedMetric(PredefinedMetric.APPSTREAM_AVERAGE_CAPACITY_UTILIZATION)
.resourceLabel("resourceLabel")
.scaleInCooldown(Duration.minutes(30))
.scaleOutCooldown(Duration.minutes(30))
.build();
// 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;
using Amazon.CDK.AWS.ApplicationAutoScaling;
using Amazon.CDK.AWS.CloudWatch;
using Amazon.CDK.Interfaces.ApplicationAutoScaling;
Metric metric;
IScalableTargetRef scalableTargetRef;
var targetTrackingScalingPolicyProps = new TargetTrackingScalingPolicyProps {
ScalingTarget = scalableTargetRef,
TargetValue = 123,
// the properties below are optional
CustomMetric = metric,
DisableScaleIn = false,
PolicyName = "policyName",
PredefinedMetric = PredefinedMetric.APPSTREAM_AVERAGE_CAPACITY_UTILIZATION,
ResourceLabel = "resourceLabel",
ScaleInCooldown = Duration.Minutes(30),
ScaleOutCooldown = Duration.Minutes(30)
};
// 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"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var metric Metric
var scalableTargetRef IScalableTargetRef
targetTrackingScalingPolicyProps := &TargetTrackingScalingPolicyProps{
ScalingTarget: scalableTargetRef,
TargetValue: jsii.Number(123),
// the properties below are optional
CustomMetric: metric,
DisableScaleIn: jsii.Boolean(false),
PolicyName: jsii.String("policyName"),
PredefinedMetric: awscdk.Aws_applicationautoscaling.PredefinedMetric_APPSTREAM_AVERAGE_CAPACITY_UTILIZATION,
ResourceLabel: jsii.String("resourceLabel"),
ScaleInCooldown: cdk.Duration_Minutes(jsii.Number(30)),
ScaleOutCooldown: cdk.Duration_*Minutes(jsii.Number(30)),
}
Properties
customMetricoptionalIMetriccustom_metricoptionalIMetriccustomMetricoptionalIMetricCustomMetricoptionalIMetricCustomMetricoptionalIMetric #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.
The metric must be in the same account and region as the scaling policy.
Exactly one of customMetric or predefinedMetric must be specified.
disableScaleInoptionalbooleandisable_scale_inoptionalbooldisableScaleInoptionalBooleanDisableScaleInoptionalboolDisableScaleInoptional*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.
policyNameoptionalstringpolicy_nameoptionalstrpolicyNameoptionalStringPolicyNameoptionalstringPolicyNameoptional*string #Default: Automatically generated name.
predefinedMetricoptionalPredefinedMetricpredefined_metricoptionalPredefinedMetricpredefinedMetricoptionalPredefinedMetricPredefinedMetricoptionalPredefinedMetricPredefinedMetricoptionalPredefinedMetric #Default: 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.
resourceLabeloptionalstringresource_labeloptionalstrresourceLabeloptionalStringResourceLabeloptionalstringResourceLabeloptional*string #Default: 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>
scaleInCooldownoptionalDurationscale_in_cooldownoptionalDurationscaleInCooldownoptionalDurationScaleInCooldownoptionalDurationScaleInCooldownoptionalDuration #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
scaleOutCooldownoptionalDurationscale_out_cooldownoptionalDurationscaleOutCooldownoptionalDurationScaleOutCooldownoptionalDurationScaleOutCooldownoptionalDuration #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_targetIScalableTargetRefscalingTargetIScalableTargetRefScalingTargetIScalableTargetRefScalingTargetIScalableTargetRef required #targetValuenumbertarget_valueint | floattargetValueNumberTargetValuedoubleTargetValue*float64 required #