ScalableTaskCount

class aws_cdk.aws_ecs.ScalableTaskCount(scope, id, *, dimension, resource_id, role, service_namespace, max_capacity, min_capacity=None)

Bases: aws_cdk.aws_applicationautoscaling.BaseScalableAttribute

The scalable attribute representing task count.

__init__(scope, id, *, dimension, resource_id, role, service_namespace, max_capacity, min_capacity=None)

Constructs a new instance of the ScalableTaskCount class.

Parameters
  • scope (Construct) –

  • id (str) –

  • props

  • dimension (str) – Scalable dimension of the attribute.

  • resource_id (str) – Resource ID of the attribute.

  • role (IRole) – Role to use for scaling.

  • service_namespace (ServiceNamespace) – Service namespace of the scalable attribute.

  • max_capacity (Union[int, float]) – Maximum capacity to scale to.

  • min_capacity (Union[int, float, None]) – Minimum capacity to scale to. Default: 1

Return type

None

Methods

scale_on_cpu_utilization(id, *, target_utilization_percent, disable_scale_in=None, policy_name=None, scale_in_cooldown=None, scale_out_cooldown=None)

Scales in or out to achieve a target CPU utilization.

Parameters
  • id (str) –

  • props

  • target_utilization_percent (Union[int, float]) – The target value for CPU utilization across all tasks in the service.

  • 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: - No scale in cooldown.

  • scale_out_cooldown (Optional[Duration]) – Period after a scale out activity completes before another scale out activity can start. Default: - No scale out cooldown.

Return type

None

scale_on_memory_utilization(id, *, target_utilization_percent, disable_scale_in=None, policy_name=None, scale_in_cooldown=None, scale_out_cooldown=None)

Scales in or out to achieve a target memory utilization.

Parameters
  • id (str) –

  • props

  • target_utilization_percent (Union[int, float]) – The target value for memory utilization across all tasks in the service.

  • 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: - No scale in cooldown.

  • scale_out_cooldown (Optional[Duration]) – Period after a scale out activity completes before another scale out activity can start. Default: - No scale out cooldown.

Return type

None

scale_on_metric(id, *, metric, scaling_steps, adjustment_type=None, cooldown=None, min_adjustment_magnitude=None)

Scales in or out based on a specified metric value.

Parameters
  • id (str) –

  • props

  • metric (IMetric) – Metric to scale on.

  • scaling_steps (List[ScalingInterval]) – The intervals for scaling. Maps a range of metric values to a particular scaling behavior.

  • adjustment_type (Optional[AdjustmentType]) – How the adjustment numbers inside ‘intervals’ are interpreted. Default: ChangeInCapacity

  • cooldown (Optional[Duration]) – Grace period after scaling activity. Subsequent scale outs during the cooldown period are squashed so that only the biggest scale out happens. Subsequent scale ins during the cooldown period are ignored. Default: No cooldown period

  • min_adjustment_magnitude (Union[int, float, None]) – Minimum absolute number to adjust capacity with as result of percentage scaling. Only when using AdjustmentType = PercentChangeInCapacity, this number controls the minimum absolute effect size. Default: No minimum scaling effect

Return type

None

scale_on_request_count(id, *, requests_per_target, target_group, disable_scale_in=None, policy_name=None, scale_in_cooldown=None, scale_out_cooldown=None)

Scales in or out to achieve a target Application Load Balancer request count per target.

Parameters
  • id (str) –

  • props

  • requests_per_target (Union[int, float]) – The number of ALB requests per target.

  • target_group (ApplicationTargetGroup) – The ALB target group name.

  • 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: - No scale in cooldown.

  • scale_out_cooldown (Optional[Duration]) – Period after a scale out activity completes before another scale out activity can start. Default: - No scale out cooldown.

Return type

None

scale_on_schedule(id, *, schedule, end_time=None, max_capacity=None, min_capacity=None, start_time=None)

Scales in or out based on a specified scheduled time.

Parameters
  • id (str) –

  • props

  • schedule (Schedule) – When to perform this action.

  • end_time (Optional[datetime]) – When this scheduled action expires. Default: The rule never expires.

  • max_capacity (Union[int, float, None]) – The new maximum capacity. During the scheduled time, the current capacity is above the maximum capacity, Application Auto Scaling scales in to the maximum capacity. At least one of maxCapacity and minCapacity must be supplied. Default: No new maximum capacity

  • min_capacity (Union[int, float, None]) – The new minimum capacity. During the scheduled time, if the current capacity is below the minimum capacity, Application Auto Scaling scales out to the minimum capacity. At least one of maxCapacity and minCapacity must be supplied. Default: No new minimum capacity

  • start_time (Optional[datetime]) – When this scheduled action becomes active. Default: The rule is activate immediately

Return type

None

scale_to_track_custom_metric(id, *, metric, target_value, disable_scale_in=None, policy_name=None, scale_in_cooldown=None, scale_out_cooldown=None)

Scales in or out to achieve a target on a custom metric.

Parameters
  • id (str) –

  • props

  • 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.

  • 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: - No scale in cooldown.

  • scale_out_cooldown (Optional[Duration]) – Period after a scale out activity completes before another scale out activity can start. Default: - No scale out cooldown.

Return type

None

to_string()

Returns a string representation of this construct.

Return type

str

Attributes

node

Construct tree node which offers APIs for interacting with the construct tree.

Return type

ConstructNode

Static Methods

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool