StepScalingAction
Define a step scaling action.
This kind of scaling policy adjusts the target capacity in configurable steps. The size of the step is configurable based on the metric's distance to its alarm threshold.
This Action must be used as the target of a CloudWatch alarm to take effect.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_applicationautoscaling as appscaling } from 'aws-cdk-lib';
import { aws_applicationautoscaling as interfaces_applicationautoscaling } from 'aws-cdk-lib/interfaces';
declare const scalableTargetRef: interfaces_applicationautoscaling.IScalableTargetRef;
const stepScalingAction = new appscaling.StepScalingAction(this, 'MyStepScalingAction', {
scalingTarget: scalableTargetRef,
// the properties below are optional
adjustmentType: appscaling.AdjustmentType.CHANGE_IN_CAPACITY,
cooldown: cdk.Duration.minutes(30),
metricAggregationType: appscaling.MetricAggregationType.AVERAGE,
minAdjustmentMagnitude: 123,
policyName: 'policyName',
});
# 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.interfaces import aws_applicationautoscaling as interfaces_applicationautoscaling
# scalable_target_ref: interfaces_applicationautoscaling.IScalableTargetRef
step_scaling_action = appscaling.StepScalingAction(self, "MyStepScalingAction",
scaling_target=scalable_target_ref,
# the properties below are optional
adjustment_type=appscaling.AdjustmentType.CHANGE_IN_CAPACITY,
cooldown=cdk.Duration.minutes(30),
metric_aggregation_type=appscaling.MetricAggregationType.AVERAGE,
min_adjustment_magnitude=123,
policy_name="policyName"
)
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.applicationautoscaling.*;
import software.amazon.awscdk.interfaces.applicationautoscaling.*;
IScalableTargetRef scalableTargetRef;
StepScalingAction stepScalingAction = StepScalingAction.Builder.create(this, "MyStepScalingAction")
.scalingTarget(scalableTargetRef)
// the properties below are optional
.adjustmentType(AdjustmentType.CHANGE_IN_CAPACITY)
.cooldown(Duration.minutes(30))
.metricAggregationType(MetricAggregationType.AVERAGE)
.minAdjustmentMagnitude(123)
.policyName("policyName")
.build();
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.ApplicationAutoScaling;
using Amazon.CDK.Interfaces.ApplicationAutoScaling;
IScalableTargetRef scalableTargetRef;
var stepScalingAction = new StepScalingAction(this, "MyStepScalingAction", new StepScalingActionProps {
ScalingTarget = scalableTargetRef,
// the properties below are optional
AdjustmentType = AdjustmentType.CHANGE_IN_CAPACITY,
Cooldown = Duration.Minutes(30),
MetricAggregationType = MetricAggregationType.AVERAGE,
MinAdjustmentMagnitude = 123,
PolicyName = "policyName"
});
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var scalableTargetRef IScalableTargetRef
stepScalingAction := awscdk.Aws_applicationautoscaling.NewStepScalingAction(this, jsii.String("MyStepScalingAction"), &StepScalingActionProps{
ScalingTarget: scalableTargetRef,
// the properties below are optional
AdjustmentType: awscdk.*Aws_applicationautoscaling.AdjustmentType_CHANGE_IN_CAPACITY,
Cooldown: cdk.Duration_Minutes(jsii.Number(30)),
MetricAggregationType: awscdk.*Aws_applicationautoscaling.MetricAggregationType_AVERAGE,
MinAdjustmentMagnitude: jsii.Number(123),
PolicyName: jsii.String("policyName"),
})
Initializer
new StepScalingAction(scope: Construct, id: string, props: StepScalingActionProps)
StepScalingAction(scope: Construct, id: str, props: StepScalingActionProps)
new StepScalingAction(Construct scope, String id, StepScalingActionProps props)
new StepScalingAction(Construct scope, string id, StepScalingActionProps props)
NewStepScalingAction(Scope Construct, Id *string, Props StepScalingActionProps)
Construct Props
adjustmentTypeoptionalAdjustmentTypeadjustment_typeoptionalAdjustmentTypeadjustmentTypeoptionalAdjustmentTypeAdjustmentTypeoptionalAdjustmentTypeAdjustmentTypeoptionalAdjustmentType= ChangeInCapacity#cooldownoptionalDurationcooldownoptionalDurationcooldownoptionalDurationCooldownoptionalDurationCooldownoptionalDuration#Default: No cooldown period
For scale out policies, multiple scale outs during the cooldown period are squashed so that only the biggest scale out happens.
For scale in policies, subsequent scale ins during the cooldown period are ignored.
metricAggregationTypeoptionalMetricAggregationTypemetric_aggregation_typeoptionalMetricAggregationTypemetricAggregationTypeoptionalMetricAggregationTypeMetricAggregationTypeoptionalMetricAggregationTypeMetricAggregationTypeoptionalMetricAggregationType= Average#minAdjustmentMagnitudeoptionalnumbermin_adjustment_magnitudeoptionalint | floatminAdjustmentMagnitudeoptionalNumberMinAdjustmentMagnitudeoptionaldoubleMinAdjustmentMagnitudeoptional*float64#Default: No minimum scaling effect
Only when using AdjustmentType = PercentChangeInCapacity, this number controls the minimum absolute effect size.
policyNameoptionalstringpolicy_nameoptionalstrpolicyNameoptionalStringPolicyNameoptionalstringPolicyNameoptional*string#Default: Automatically generated name
scalingTargetIScalableTargetRefscaling_targetIScalableTargetRefscalingTargetIScalableTargetRefScalingTargetIScalableTargetRefScalingTargetIScalableTargetRefrequired#Properties
Methods
addAdjustment(adjustment: AdjustmentTier): voiddef add_adjustment(self, adjustment: AdjustmentTier) -> Nonepublic void addAdjustment(AdjustmentTier adjustment)public void AddAdjustment(AdjustmentTier adjustment)func AddAdjustment(Adjustment AdjustmentTier)#isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct 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 class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof 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 the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.
1 parameter · returns
Parameters
mixinsmixinsmixinsmixinsMixins— The mixins to apply.
Returns: This construct for chaining