Skip to content
v2.274.0

TrackCustomMetricProps Struct ​

The properties for enabling target tracking scaling based on a custom CloudWatch metric.

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_cloudwatch as cloudwatch } from 'aws-cdk-lib';
import { aws_ecs as ecs } from 'aws-cdk-lib';

declare const metric: cloudwatch.Metric;
const trackCustomMetricProps: ecs.TrackCustomMetricProps = {
  metric: metric,
  targetValue: 123,

  // the properties below are optional
  disableScaleIn: false,
  policyName: 'policyName',
  scaleInCooldown: cdk.Duration.minutes(30),
  scaleOutCooldown: cdk.Duration.minutes(30),
};

Properties ​

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 scalable resource. Otherwise, scale in is enabled and the target tracking policy can remove capacity from the scalable resource.

metricIMetricmetricIMetricmetricIMetricMetricIMetricMetricIMetricrequired#
The custom CloudWatch metric to track.

The metric must represent utilization; that is, you will always get the following behavior:

  • metric > targetValue => scale out
  • metric < targetValue => scale in
policyNameoptionalstringpolicy_nameoptionalstrpolicyNameoptionalStringPolicyNameoptionalstringPolicyNameoptional*string#
A name for the scaling policy.

Default: Automatically generated name.

scaleInCooldownoptionalDurationscale_in_cooldownoptionalDurationscaleInCooldownoptionalDurationScaleInCooldownoptionalDurationScaleInCooldownoptionalDuration#
Period after a scale in activity completes before another scale in activity can start.

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#
Period after a scale out activity completes before another scale out activity can start.

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

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