Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoScaling: Validate use of Cooldown #32667

Open
1 of 2 tasks
ryanwilliams83 opened this issue Dec 27, 2024 · 4 comments
Open
1 of 2 tasks

AutoScaling: Validate use of Cooldown #32667

ryanwilliams83 opened this issue Dec 27, 2024 · 4 comments
Labels
@aws-cdk/aws-autoscaling Related to Amazon EC2 Auto Scaling documentation This is a problem with documentation. effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p3

Comments

@ryanwilliams83
Copy link

Describe the feature

Cooldown only applies to simple scaling policy.
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-scalingpolicy.html#cfn-autoscaling-scalingpolicy-cooldown

Please consider enhancing CDK to trap for the following configuration when executed with the --ci switch.
To inform users that the cooldown will not have any effect.

asg.ScaleOnCpuUtilization('ALowCpuLoad', {
cooldown = cdk.Duration.minutes(666), // Has no effect when the policyType is TargetTrackingScaling
estimatedInstanceWarmup = cdk.Duration.minutes(10),
targetUtilizationPercent: 45
});

Use Case

I was mislead by the CDK intrinsic documentation.

Cooldown: Period after a scaling completes before another scaling activity can start.
Default: The default cooldown configured on the AutoScalingGroup.

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.165.0

Environment details (OS name and version, etc.)

Windows, C#, Constructs 10.4.2

@ryanwilliams83 ryanwilliams83 added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Dec 27, 2024
@github-actions github-actions bot added the @aws-cdk/aws-autoscaling Related to Amazon EC2 Auto Scaling label Dec 27, 2024
@ryanwilliams83
Copy link
Author

An example of some synthesized CloudFormation containing Cooldown and also TargetTrackingScaling.

    "AutoScalingGroupScalingPolicyALowCpuLoadE60B7782": {
      "Type": "AWS::AutoScaling::ScalingPolicy",
      "Properties": {
        "AutoScalingGroupName": {
          "Ref": "AutoScalingGroupASG804C35BE"
        },
        "Cooldown": "1500",
        "EstimatedInstanceWarmup": 1200,
        "PolicyType": "TargetTrackingScaling",
        "TargetTrackingConfiguration": {
          "PredefinedMetricSpecification": {
            "PredefinedMetricType": "ASGAverageCPUUtilization"
          },
          "TargetValue": 45
        }
      },
      "DependsOn": [
        "AutoScalingGroupWarmPool7145D5D8",
        "SsmParameterCloudWatchAgentConfig"
      ],
      "Metadata": {
        "aws:cdk:path": "GisMaps/AutoScalingGroup/ScalingPolicyALowCpuLoad/Resource"
      }
    },

@khushail khushail added investigating This issue is being investigated and/or work is in progress to resolve the issue. p2 and removed needs-triage This issue or PR still needs to be triaged. labels Dec 27, 2024
@khushail khushail self-assigned this Dec 27, 2024
@khushail
Copy link
Contributor

@ryanwilliams83 , thanks for reaching out.

Please help me re-iterate on your ask here -

  1. More clear CDK Documentationa around cooldown property here which says -
cooldown?

Type: [Duration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Duration.html) (optional, default: Duration.minutes(5))

Default scaling cooldown for this AutoScalingGroup.

while in Cloudformation docs, its clearly mentioned that Cooldown is needed only if you use simple scaling policies.

  1. Feature request for addition of this --ci which would work for TargetScalingPolicy and coolDown` will have no effect as mentioned in this API Doc as suggested in your code.

@khushail khushail added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Dec 30, 2024
@ryanwilliams83
Copy link
Author

@khushail, please disregard the --ci switch that I mentioned.
I thought it introduced additional sanity checks during synth but I must be mistaken because the cdk --help documentation simply states.

--ci                 Force CI detection. If CI=true then logs will be sent
                           to stdout instead of stderr[boolean] [default: false]

So to reiterate,

  1. Please update the CDK documentation on the cooldown property so it clearly informs users that it only applies to SimpleScalingPolicies.
  2. Please consider modifying CloudFormation to warn or reject templates that attempt to specify the Cooldown property in conjunction with a Policy other than simple.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Dec 31, 2024
@khushail khushail added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Jan 2, 2025
@khushail
Copy link
Contributor

khushail commented Jan 3, 2025

@khushail, please disregard the --ci switch that I mentioned. I thought it introduced additional sanity checks during synth but I must be mistaken because the cdk --help documentation simply states.

--ci                 Force CI detection. If CI=true then logs will be sent
                           to stdout instead of stderr[boolean] [default: false]

So to reiterate,

1. Please update the CDK documentation on the `cooldown` property so it clearly informs users that it only applies to SimpleScalingPolicies.

2. Please consider modifying CloudFormation to warn or reject templates that attempt to specify the `Cooldown` property in conjunction with a Policy other than simple.

Thanks for clarification there @ryanwilliams83 . Regarding your requests -

  1. Documentation around cooldown property in CDK would be helpful to have. Contributions from community are welcome in this regards, hence marking it as P3.
  2. This check could be implemented by Cloudformation as the PolicyType is coming from L1 construct. You could open an issue with Cloudformation team, on this Cloudformation coverage roadmap and follow the same for updates.

Hope that would be helpful.

@khushail khushail added p3 and removed p2 investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Jan 3, 2025
@khushail khushail removed their assignment Jan 3, 2025
@khushail khushail added documentation This is a problem with documentation. effort/small Small work item – less than a day of effort labels Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-autoscaling Related to Amazon EC2 Auto Scaling documentation This is a problem with documentation. effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p3
Projects
None yet
Development

No branches or pull requests

2 participants