TrackCustomMetricProps

class aws_cdk.aws_ecs.TrackCustomMetricProps(*, disable_scale_in=None, policy_name=None, scale_in_cooldown=None, scale_out_cooldown=None, metric, target_value)

Bases: BaseTargetTrackingProps

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

Parameters:
  • disable_scale_in (Optional[bool]) – 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. Default: false

  • policy_name (Optional[str]) – A name for the scaling policy. Default: - Automatically generated name.

  • scale_in_cooldown (Optional[Duration]) – 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

  • scale_out_cooldown (Optional[Duration]) – 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

  • metric (IMetric) – 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

  • target_value (Union[int, float]) – The target value for the custom CloudWatch metric.

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudwatch as cloudwatch
import aws_cdk.aws_ecs as ecs
import aws_cdk.core as cdk

# metric: cloudwatch.Metric

track_custom_metric_props = ecs.TrackCustomMetricProps(
    metric=metric,
    target_value=123,

    # the properties below are optional
    disable_scale_in=False,
    policy_name="policyName",
    scale_in_cooldown=cdk.Duration.minutes(30),
    scale_out_cooldown=cdk.Duration.minutes(30)
)

Attributes

disable_scale_in

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.

Default:

false

metric

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

policy_name

A name for the scaling policy.

Default:
  • Automatically generated name.

scale_in_cooldown

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

scale_out_cooldown

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

target_value

The target value for the custom CloudWatch metric.