-
Notifications
You must be signed in to change notification settings - Fork 4.5k
aws-autoscaling: Step scaling properties expose unsupported cooldown property #29779
Description
Describe the bug
The StepScalingPolicyProps interface and related StepScalingActionProps interface expose a cooldown property, which if specified becomes the cooldown property of a CfnScalingPolicy here:
| cooldown: props.cooldown && props.cooldown.toSeconds().toString(), |
However, cooldown is not a supported property for step scaling policies. The documentation for the AWS::AutoScaling::ScalingPolicy resource says:
Valid only if the policy type is
SimpleScaling. For more information, see Scaling cooldowns for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
Specifying this property has no effect and can cause CloudFormation deployment errors in some regions (such as ap-southeast-4).
Expected Behavior
Since this property has no effect and can cause deployment errors, it should not be possible to specify for step scaling policies and should be deprecated.
Current Behavior
The property can be specified and results in an AWS::AutoScaling::ScalingPolicy with PolicyType set to StepScaling and the Cooldown property present. This is ineffectual or can cause the following error on deployment, depending on the region:
Property Cooldown cannot be specified.
Reproduction Steps
The following application reproduces the deployment error when deployed to ap-southeast-4.
import { App, Duration, Stack, StackProps } from 'aws-cdk-lib';
import { AutoScalingGroup, } from 'aws-cdk-lib/aws-autoscaling';
import { AmazonLinuxCpuType, InstanceClass, InstanceSize, InstanceType, MachineImage, Vpc } from 'aws-cdk-lib/aws-ec2';
import { Construct } from 'constructs';
import { Metric } from 'aws-cdk-lib/aws-cloudwatch';
export class ReproStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const vpc = new Vpc(this, "VPC");
const asg = new AutoScalingGroup(this, "ASG", {
vpc,
machineImage: MachineImage.latestAmazonLinux2023({ cpuType: AmazonLinuxCpuType.ARM_64 }),
instanceType: InstanceType.of(InstanceClass.T4G, InstanceSize.MICRO),
});
const metric = new Metric({
namespace: "Repro",
metricName: "Metric",
});
asg.scaleOnMetric("MetricScale", {
metric,
scalingSteps: [
{ upper: 10, change: -5 },
{ lower: 50, change: 5 }
],
cooldown: Duration.minutes(5),
})
}
}
const app = new App();
new ReproStack(app, "Repro");Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.136.1
Framework Version
No response
Node.js Version
v18.0.0
OS
macOS
Language
TypeScript
Language Version
5.4.3
Other information
(Amazon ticket D120666119 has some more detail.)