(autoscaling): add `simpleScaling` API
Currently the only way to create a simple scaling policy is to use the L1 CfnScalingPolicy type. In turn this makes it more difficult to create simple scaling policies that trigger off L2 alarms.
Use Case
This will make life a little easier when dealing with alarms but there may be other use cases I'm not aware of.
Proposed Solution
export interface SimpleScalingActionProps {
adjustmentType: autoscaling.AdjustmentType;
scalingAdjustment: number;
cooldown: Duration;
autoScalingGroup: autoscaling.AutoScalingGroup;
}
export class SimpleScalingAction extends Construct {
public readonly scalingPolicyArn: string;
constructor(scope: Construct, id: string, props: SimpleScalingActionProps) {
super(scope, id);
const resource = new CfnScalingPolicy(this, 'Resource', {
policyType: 'SimpleScaling',
autoScalingGroupName: props.autoScalingGroup.autoScalingGroupName,
cooldown: props.cooldown && props.cooldown.toSeconds().toString(),
scalingAdjustment: props.scalingAdjustment,
adjustmentType: props.adjustmentType,
});
this.scalingPolicyArn = resource.ref;
}
}
export class SimpleScalingCloudwatchAction implements cloudwatch.IAlarmAction {
constructor(private readonly simpleScalingAction: SimpleScalingAction) {
}
bind(scope: Construct, alarm: cloudwatch.IAlarm): cloudwatch.AlarmActionConfig {
return { alarmActionArn: this.simpleScalingAction.scalingPolicyArn }
}
}
This is a :rocket: Feature Request
Take a look at how the application autoscaling module is use in Lambda and DynamoDB
Take a look at how the application autoscaling module is use in Lambda and DynamoDB
This would be for scaling EC2 ASGs rather than serverless.
The AutoScaling L2 library will create the required CloudWatch alarms and AutoScaling policies for you.
I might be missing something in your feature request, can you explain how would your desired API look in the AutoScaling L2 ? For example, how will it be different than the scaleOnMetric API?
The key here is the PolicyType: SimpleScaling.
StepScaling and TargetTracking seem to be well supported but not SimpleScaling
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-as-scalingpolicy-policytype
got it.
Is there any update on this?
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
Came here looking for this feature - still isn't present Autoscaling seems "quite hard" on EC2 with no easy access to Autoscaling metrics via the AutoScalingGroup object - information also very hard to find!