class TargetTrackingScalingPolicy (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.AutoScaling.TargetTrackingScalingPolicy |
Java | software.amazon.awscdk.services.autoscaling.TargetTrackingScalingPolicy |
Python | aws_cdk.aws_autoscaling.TargetTrackingScalingPolicy |
TypeScript (source) | @aws-cdk/aws-autoscaling » TargetTrackingScalingPolicy |
Implements
IConstruct
, IConstruct
, IDependable
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as autoscaling from '@aws-cdk/aws-autoscaling';
import * as cloudwatch from '@aws-cdk/aws-cloudwatch';
import * as cdk from '@aws-cdk/core';
declare const autoScalingGroup: autoscaling.AutoScalingGroup;
declare const metric: cloudwatch.Metric;
const targetTrackingScalingPolicy = new autoscaling.TargetTrackingScalingPolicy(this, 'MyTargetTrackingScalingPolicy', {
autoScalingGroup: autoScalingGroup,
targetValue: 123,
// the properties below are optional
cooldown: cdk.Duration.minutes(30),
customMetric: metric,
disableScaleIn: false,
estimatedInstanceWarmup: cdk.Duration.minutes(30),
predefinedMetric: autoscaling.PredefinedMetric.ASG_AVERAGE_CPU_UTILIZATION,
resourceLabel: 'resourceLabel',
});
Initializer
new TargetTrackingScalingPolicy(scope: Construct, id: string, props: TargetTrackingScalingPolicyProps)
Parameters
- scope
Construct
- id
string
- props
Target
Tracking Scaling Policy Props
Construct Props
Name | Type | Description |
---|---|---|
auto | IAuto | |
target | number | The target value for the metric. |
cooldown? | Duration | Period after a scaling completes before another scaling activity can start. |
custom | IMetric | A custom metric for application autoscaling. |
disable | boolean | Indicates whether scale in by the target tracking policy is disabled. |
estimated | Duration | Estimated time until a newly launched instance can send metrics to CloudWatch. |
predefined | Predefined | A predefined metric for application autoscaling. |
resource | string | The resource label associated with the predefined metric. |
autoScalingGroup
Type:
IAuto
targetValue
Type:
number
The target value for the metric.
cooldown?
Type:
Duration
(optional, default: The default cooldown configured on the AutoScalingGroup.)
Period after a scaling completes before another scaling activity can start.
customMetric?
Type:
IMetric
(optional, default: No custom metric.)
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.
disableScaleIn?
Type:
boolean
(optional, default: 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 autoscaling group. Otherwise, scale in is enabled and the target tracking policy can remove capacity from the group.
estimatedInstanceWarmup?
Type:
Duration
(optional, default: Same as the cooldown.)
Estimated time until a newly launched instance can send metrics to CloudWatch.
predefinedMetric?
Type:
Predefined
(optional, default: No predefined metric.)
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.
resourceLabel?
Type:
string
(optional, default: No resource label.)
The resource label associated with the predefined metric.
Should be supplied if the predefined metric is ALBRequestCountPerTarget, and the format should be:
app/<load-balancer-name>/<load-balancer-id>/targetgroup/<target-group-name>/<target-group-id>
Properties
Name | Type | Description |
---|---|---|
node | Construct | The construct tree node associated with this construct. |
scaling | string | ARN of the scaling policy. |
node
Type:
Construct
The construct tree node associated with this construct.
scalingPolicyArn
Type:
string
ARN of the scaling policy.
Methods
Name | Description |
---|---|
to | Returns a string representation of this construct. |
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.