interface BasicStepScalingPolicyProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.AutoScaling.BasicStepScalingPolicyProps |
![]() | software.amazon.awscdk.services.autoscaling.BasicStepScalingPolicyProps |
![]() | aws_cdk.aws_autoscaling.BasicStepScalingPolicyProps |
![]() | @aws-cdk/aws-autoscaling » BasicStepScalingPolicyProps |
Example
declare const autoScalingGroup: autoscaling.AutoScalingGroup;
const workerUtilizationMetric = new cloudwatch.Metric({
namespace: 'MyService',
metricName: 'WorkerUtilization'
});
autoScalingGroup.scaleOnMetric('ScaleToCPU', {
metric: workerUtilizationMetric,
scalingSteps: [
{ upper: 10, change: -1 },
{ lower: 50, change: +1 },
{ lower: 70, change: +3 },
],
// Change this to AdjustmentType.PERCENT_CHANGE_IN_CAPACITY to interpret the
// 'change' numbers before as percentages instead of capacity counts.
adjustmentType: autoscaling.AdjustmentType.CHANGE_IN_CAPACITY,
});
Properties
Name | Type | Description |
---|---|---|
metric | IMetric | Metric to scale on. |
scaling | Scaling [] | The intervals for scaling. |
adjustment | Adjustment | How the adjustment numbers inside 'intervals' are interpreted. |
cooldown? | Duration | Grace period after scaling activity. |
estimated | Duration | Estimated time until a newly launched instance can send metrics to CloudWatch. |
evaluation | number | How many evaluation periods of the metric to wait before triggering a scaling action. |
metric | Metric | Aggregation to apply to all data points over the evaluation periods. |
min | number | Minimum absolute number to adjust capacity with as result of percentage scaling. |
metric
Type:
IMetric
Metric to scale on.
scalingSteps
Type:
Scaling
[]
The intervals for scaling.
Maps a range of metric values to a particular scaling behavior.
adjustmentType?
Type:
Adjustment
(optional, default: ChangeInCapacity)
How the adjustment numbers inside 'intervals' are interpreted.
cooldown?
Type:
Duration
(optional, default: Default cooldown period on your AutoScalingGroup)
Grace period after scaling activity.
estimatedInstanceWarmup?
Type:
Duration
(optional, default: Same as the cooldown)
Estimated time until a newly launched instance can send metrics to CloudWatch.
evaluationPeriods?
Type:
number
(optional, default: 1)
How many evaluation periods of the metric to wait before triggering a scaling action.
Raising this value can be used to smooth out the metric, at the expense of slower response times.
metricAggregationType?
Type:
Metric
(optional, default: The statistic from the metric if applicable (MIN, MAX, AVERAGE), otherwise AVERAGE.)
Aggregation to apply to all data points over the evaluation periods.
Only has meaning if evaluationPeriods != 1
.
minAdjustmentMagnitude?
Type:
number
(optional, default: No minimum scaling effect)
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.