[aws_autoscaling]: Cron expression invalid
See original GitHub issueDescribe the bug
autoscaling.Schedule.cron({ minute: "*" })
produces expression that is not wrapped in cron(...)
as in aws-cdk v1.
Expected Behavior
ScheduleExpression
should be wrapped in cron(...)
. It worked in v1.
Current Behavior
Produces resource with invalid ScheduleExpression
prop:
{
"Resources": {
"ruleF2C1DCDC": {
"Type": "AWS::Events::Rule",
"Properties": {
"ScheduleExpression": "* * * * *",
"State": "ENABLED"
},
"Metadata": {
"aws:cdk:path": "TestStack/rule/Resource"
}
}
},
/// ....
Reproduction Steps
Following code:
#!/usr/bin/env ts-node
import * as cdk from 'aws-cdk-lib';
import { aws_autoscaling as autoscaling } from 'aws-cdk-lib';
import { aws_events as events } from 'aws-cdk-lib';
const app = new cdk.App();
const scope = new cdk.Stack(app, "TestStack")
const expression = autoscaling.Schedule.cron({ minute: "*" });
const rule = new events.Rule(scope, 'rule', { schedule: expression });
Produces resource with invalid ScheduleExpression
prop:
{
"Resources": {
"ruleF2C1DCDC": {
"Type": "AWS::Events::Rule",
"Properties": {
"ScheduleExpression": "* * * * *",
"State": "ENABLED"
},
"Metadata": {
"aws:cdk:path": "TestStack/rule/Resource"
}
}
},
/// ....
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.31.0 (build b67950d)
Framework Version
No response
Node.js Version
v16.14.0
OS
Mac OS 12.3
Language
Typescript
Language Version
No response
Other information
No response
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Parameter ScheduleExpression is not valid - Stack Overflow
I have tried setting the cron expression on the Lambda console (when creating the function and choosing Cloudwatch Schedule Event), and in the...
Read more >Example scheduled actions for Application Auto Scaling
To schedule scaling on a recurring schedule, use the --schedule "cron( fields )" option. For more information, see Schedule recurring scaling actions using...
Read more >Schedule Expressions for Rules - Amazon CloudWatch Events
Describes how to use cron or rate expressions to automate AWS with Amazon CloudWatch Events.
Read more >Troubleshoot service auto scaling issues in Amazon ECS
The service auto scaling configured for my Amazon Elastic ... The cron expression format is incorrectly specified in the scheduled action.
Read more >Reference: Cron and rate expressions for Systems Manager
When you create a State Manager association or a maintenance window in AWS Systems Manager, you specify a schedule for when the window...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I know the naming isn’t ideal but I don’t actually think this is something we should be handling for. As long as it’s clearly documented, which I believe it is, it is the users responsibility to ensure they’re importing the correct version of a class. If we tried to do this for every instance of a class that shares a name in a different module, it would be extremely messy.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.