Class TargetTrackingScalingPolicy.Builder

java.lang.Object
software.amazon.awscdk.services.applicationautoscaling.TargetTrackingScalingPolicy.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<TargetTrackingScalingPolicy>
Enclosing class:
TargetTrackingScalingPolicy

@Stability(Stable) public static final class TargetTrackingScalingPolicy.Builder extends Object implements software.amazon.jsii.Builder<TargetTrackingScalingPolicy>
A fluent builder for TargetTrackingScalingPolicy.
  • Method Details

    • create

      @Stability(Stable) public static TargetTrackingScalingPolicy.Builder create(software.constructs.Construct scope, String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      Returns:
      a new instance of TargetTrackingScalingPolicy.Builder.
    • disableScaleIn

      @Stability(Stable) public TargetTrackingScalingPolicy.Builder disableScaleIn(Boolean disableScaleIn)
      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

      Parameters:
      disableScaleIn - Indicates whether scale in by the target tracking policy is disabled. This parameter is required.
      Returns:
      this
    • policyName

      @Stability(Stable) public TargetTrackingScalingPolicy.Builder policyName(String policyName)
      A name for the scaling policy.

      Default: - Automatically generated name.

      Parameters:
      policyName - A name for the scaling policy. This parameter is required.
      Returns:
      this
    • scaleInCooldown

      @Stability(Stable) public TargetTrackingScalingPolicy.Builder scaleInCooldown(Duration scaleInCooldown)
      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

      Parameters:
      scaleInCooldown - Period after a scale in activity completes before another scale in activity can start. This parameter is required.
      Returns:
      this
    • scaleOutCooldown

      @Stability(Stable) public TargetTrackingScalingPolicy.Builder scaleOutCooldown(Duration scaleOutCooldown)
      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

      Parameters:
      scaleOutCooldown - Period after a scale out activity completes before another scale out activity can start. This parameter is required.
      Returns:
      this
    • targetValue

      @Stability(Stable) public TargetTrackingScalingPolicy.Builder targetValue(Number targetValue)
      The target value for the metric.

      Parameters:
      targetValue - The target value for the metric. This parameter is required.
      Returns:
      this
    • customMetric

      @Stability(Stable) public TargetTrackingScalingPolicy.Builder customMetric(IMetric customMetric)
      A custom metric for application autoscaling.

      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.

      Default: - No custom metric.

      Parameters:
      customMetric - A custom metric for application autoscaling. This parameter is required.
      Returns:
      this
    • predefinedMetric

      @Stability(Stable) public TargetTrackingScalingPolicy.Builder predefinedMetric(PredefinedMetric predefinedMetric)
      A predefined metric for application autoscaling.

      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.

      Default: - No predefined metrics.

      Parameters:
      predefinedMetric - A predefined metric for application autoscaling. This parameter is required.
      Returns:
      this
    • resourceLabel

      @Stability(Stable) public TargetTrackingScalingPolicy.Builder resourceLabel(String resourceLabel)
      Identify the resource associated with the metric type.

      Only used for predefined metric ALBRequestCountPerTarget.

      Example value: app/<load-balancer-name>/<load-balancer-id>/targetgroup/<target-group-name>/<target-group-id>

      Default: - No resource label.

      Parameters:
      resourceLabel - Identify the resource associated with the metric type. This parameter is required.
      Returns:
      this
    • scalingTarget

      @Stability(Stable) public TargetTrackingScalingPolicy.Builder scalingTarget(IScalableTarget scalingTarget)
      Parameters:
      scalingTarget - This parameter is required.
      Returns:
      this
    • build

      @Stability(Stable) public TargetTrackingScalingPolicy build()
      Specified by:
      build in interface software.amazon.jsii.Builder<TargetTrackingScalingPolicy>
      Returns:
      a newly built instance of TargetTrackingScalingPolicy.