TargetTrackingScalingPolicy
- class aws_cdk.aws_applicationautoscaling.TargetTrackingScalingPolicy(scope, id, *, scaling_target, target_value, custom_metric=None, predefined_metric=None, resource_label=None, disable_scale_in=None, policy_name=None, scale_in_cooldown=None, scale_out_cooldown=None)
Bases:
Construct
- 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 as cdk from aws_cdk import aws_applicationautoscaling as appscaling from aws_cdk import aws_cloudwatch as cloudwatch # metric: cloudwatch.Metric # scalable_target: appscaling.ScalableTarget target_tracking_scaling_policy = appscaling.TargetTrackingScalingPolicy(self, "MyTargetTrackingScalingPolicy", scaling_target=scalable_target, 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) )
- Parameters:
scope (
Construct
) –id (
str
) –scaling_target (
IScalableTarget
) –target_value (
Union
[int
,float
]) – The target value for the metric.custom_metric (
Optional
[IMetric
]) – 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.predefined_metric (
Optional
[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.resource_label (
Optional
[str
]) – 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.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: falsepolicy_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 concurrencyscale_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
Methods
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- node
The tree node.
- scaling_policy_arn
ARN of the scaling policy.
Static Methods
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
instances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructs
library on disk are seen as independent, completely different libraries. As a consequence, the classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
the other class.npm install
will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.