fix(applicationautoscaling): validate schedule expression format in scaleOnSchedule#37237
fix(applicationautoscaling): validate schedule expression format in scaleOnSchedule#37237
Conversation
…caleOnSchedule Add runtime validation in `ScalableTarget.scaleOnSchedule()` to check that the schedule expression matches valid Application Auto Scaling formats: `cron(...)`, `rate(...)`, or `at(...)`. This catches the common mistake of importing `Schedule` from `aws-cdk-lib/aws-autoscaling` instead of `aws-cdk-lib/aws-applicationautoscaling`, which produces bare cron expressions (e.g. `30 3 * * *`) that fail at deploy time. The validation provides a clear error message guiding users to the correct import. Closes aws#30502
There was a problem hiding this comment.
The pull request linter fails with the following errors:
❌ Fixes must contain a change to an integration test file and the resulting snapshot.
If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.
✅ A exemption request has been requested. Please wait for a maintainer's review.
|
Exemption Request This change adds a synth-time validation in An integration test is not applicable here because:
|
Description
Add runtime validation in
ScalableTarget.scaleOnSchedule()to check that the schedule expression matches valid Application Auto Scaling formats:cron(...),rate(...), orat(...).This catches the common mistake of importing
Schedulefromaws-cdk-lib/aws-autoscalinginstead ofaws-cdk-lib/aws-applicationautoscaling, which produces bare cron expressions (e.g.30 3 * * *) that fail at deploy time with a cryptic CloudFormation error.Closes #30502
What should reviewers focus on
scaleOnSchedule()— it skips unresolved Tokens and only checks resolved string expressionsChecklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license