- Newest
- Most votes
- Most comments
Your cron expression seems to be incorrect ( it should have 5 fields but your expression has 6). This may be causing CDK to parse it incorrectly and defaulting to a particular time for any Scheduled Action that you create. Please validate your cron expression on this website - https://crontab.guru/ .
CDK does support specifying the timezone along with the cron expression - https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_autoscaling.ScheduledAction.html#timezone
Actually, these cron expression are being generated by CDK using Schedule.cron(), and according to the documentation here: https://docs.aws.amazon.com/lambda/latest/dg/services-cloudwatchevents-expressions.html AWS uses a different format for cron that is 6 fields instead of 5 (this tripped me up when I first started using cron expressions with CDK, which is why I started using Schedule.cron())
It possibly could be related to using CDK v1 instead v2 though - the timezone support you linked to appears to be CDK v2 as well. So that is certainly worth trying out (now isn't the best time for me to be doing a potentially breaking update like that, but hopefully I can schedule a time in the next week to try it and see if the cron output is different too).
Relevant content
- Accepted Answerasked 3 months ago
- Accepted Answerasked 2 years ago
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 4 years ago
Is this happening consistently, or was it a 1 off? Can you provide the output of describe-scheduled-actions for both of those two actions to verify they're getting created correctly? https://docs.aws.amazon.com/cli/latest/reference/application-autoscaling/describe-scheduled-actions.html
If it was a 1 off, maybe the actions got incorrectly created one time somehow? Checking Cloudtrail for PutScheduledAction might help find out if that happened