Skip to content
v2.278.0

AdjustmentType Enum ​

How adjustment numbers are interpreted.

Example ​

ts
declare const capacity: ScalableAttribute;
declare const cpuUtilization: cloudwatch.Metric;

capacity.scaleOnMetric('ScaleToCPU', {
  metric: cpuUtilization,
  scalingSteps: [
    { upper: 10, change: -1 },
    { lower: 50, change: +1 },
    { lower: 70, change: +3 },
  ],

  // Change this to AdjustmentType.PercentChangeInCapacity to interpret the
  // 'change' numbers before as percentages instead of capacity counts.
  adjustmentType: appscaling.AdjustmentType.CHANGE_IN_CAPACITY,
});
python
# capacity: ScalableAttribute
# cpu_utilization: cloudwatch.Metric


capacity.scale_on_metric("ScaleToCPU",
    metric=cpu_utilization,
    scaling_steps=[appscaling.ScalingInterval(upper=10, change=-1), appscaling.ScalingInterval(lower=50, change=+1), appscaling.ScalingInterval(lower=70, change=+3)
    ],

    # Change this to AdjustmentType.PercentChangeInCapacity to interpret the
    # 'change' numbers before as percentages instead of capacity counts.
    adjustment_type=appscaling.AdjustmentType.CHANGE_IN_CAPACITY
)
java
ScalableAttribute capacity;
Metric cpuUtilization;


capacity.scaleOnMetric("ScaleToCPU", BasicStepScalingPolicyProps.builder()
        .metric(cpuUtilization)
        .scalingSteps(List.of(ScalingInterval.builder().upper(10).change(-1).build(), ScalingInterval.builder().lower(50).change(+1).build(), ScalingInterval.builder().lower(70).change(+3).build()))

        // Change this to AdjustmentType.PercentChangeInCapacity to interpret the
        // 'change' numbers before as percentages instead of capacity counts.
        .adjustmentType(AdjustmentType.CHANGE_IN_CAPACITY)
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
ScalableAttribute capacity;
Metric cpuUtilization;


capacity.ScaleOnMetric("ScaleToCPU", new BasicStepScalingPolicyProps {
    Metric = cpuUtilization,
    ScalingSteps = new [] { new ScalingInterval { Upper = 10, Change = -1 }, new ScalingInterval { Lower = 50, Change = +1 }, new ScalingInterval { Lower = 70, Change = +3 } },

    // Change this to AdjustmentType.PercentChangeInCapacity to interpret the
    // 'change' numbers before as percentages instead of capacity counts.
    AdjustmentType = AdjustmentType.CHANGE_IN_CAPACITY
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var capacity scalableAttribute
var cpuUtilization Metric


capacity.scaleOnMetric(jsii.String("ScaleToCPU"), &BasicStepScalingPolicyProps{
	Metric: cpuUtilization,
	ScalingSteps: []ScalingInterval{
		&ScalingInterval{
			Upper: jsii.Number(10),
			Change: -jsii.Number(1),
		},
		&ScalingInterval{
			Lower: jsii.Number(50),
			Change: +jsii.Number(1),
		},
		&ScalingInterval{
			Lower: jsii.Number(70),
			Change: +jsii.Number(3),
		},
	},

	// Change this to AdjustmentType.PercentChangeInCapacity to interpret the
	// 'change' numbers before as percentages instead of capacity counts.
	AdjustmentType: appscaling.AdjustmentType_CHANGE_IN_CAPACITY,
})

Members ​

MemberDescription
CHANGE_IN_CAPACITYAdd the adjustment number to the current capacity.
PERCENT_CHANGE_IN_CAPACITYAdd this percentage of the current capacity to itself.
EXACT_CAPACITYMake the capacity equal to the exact number given.

Referenced by ​