Commit ec18b83
authored
docs(lambda): fix incorrect import in autoscaling example (#34989)
## Description
This PR fixes issue #33593 where the Lambda autoscaling example in the documentation has an incorrect import.
### Current Behavior
The example imports `Schedule` from `aws-cdk-lib/aws-autoscaling` which generates a raw cron expression (`0 8 * * *`).
### Issue
When using `aws-autoscaling.Schedule.cron()`, the generated CloudFormation template contains a raw cron expression (`Schedule: 0 8 * * *`) which is incompatible with the `AWS::ApplicationAutoScaling::ScalableTarget` resource. This resource requires the cron expression to be wrapped with `cron(...)` and also needs the AWS-specific format with `?` character.
### Fix
The correct import should be from `aws-cdk-lib/aws-applicationautoscaling` which generates the proper format (`Schedule: cron(0 8 * * ? *)`) required by `AWS::ApplicationAutoScaling::ScalableTarget`.
fixes #33593
### Description of how you validated changes
I created a test CDK app to replicate the issue by implementing two stacks:
1. A stack using the incorrect import (`aws-autoscaling`), which generated:
Schedule: 0 8 * * *
2. A stack using the correct import (aws-applicationautoscaling
), which generated:
Schedule: cron(0 8 * * ? *)
This confirmed that the incorrect import produces an incompatible cron expression format that would fail during CloudFormation deployment.
I also verified that the test file (
packages/aws-cdk-lib/aws-lambda/test/integ.autoscaling.lit.ts
) was already using the correct import, which further confirms this is the right approach.
### Checklist
- [X] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*1 parent 7aff4dc commit ec18b83
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1177 | 1177 | | |
1178 | 1178 | | |
1179 | 1179 | | |
1180 | | - | |
| 1180 | + | |
1181 | 1181 | | |
1182 | 1182 | | |
1183 | 1183 | | |
| |||
1192 | 1192 | | |
1193 | 1193 | | |
1194 | 1194 | | |
1195 | | - | |
| 1195 | + | |
1196 | 1196 | | |
1197 | 1197 | | |
1198 | 1198 | | |
| |||
0 commit comments