By using AWS re:Post, you agree to the Terms of Use
/Scheduled Action triggering at time specified in another action/

Scheduled Action triggering at time specified in another action


I have a CloudFormation setup with Scheduled Actions to autoscale services based on times. There is one action that scales up to start the service, and another to scale down to turn it off. I also occasionally add an additional action to scale up if a service is needed at a different time on a particular day. I'm having an issue where my service is being scaled down instead of up when I specify this additional action. Looking at the console logs I get an event that looks like:

16:00:00 -0400 Message: Successfully set min capacity to 0 and max capacity to 0 Cause: scheduled action name ScheduleScaling_action_1 was triggered

However the relevant part of the CloudFormation Template for the Scheduled Action with the name in the log has a different time, e.g.:

  "ScalableTargetAction": {
    "MaxCapacity": 0,
    "MinCapacity": 0
  "Schedule": "cron(0 5 ? * 2-5 *)",
  "ScheduledActionName": "ScheduleScaling_action_1"

What is odd is that the time this action is triggering matches exactly with the Schedule time for another action. E.g.

  "ScalableTargetAction": {
    "MaxCapacity": 1,
    "MinCapacity": 1
  "Schedule": "cron(00 20 ? * 2-5 *)",
  "ScheduledActionName": "ScheduleScaling_action_2"

I am using CDK to generate the CloudFormation template, which doesn't appear to allow me to specify a timezone. So my understanding is that the times here should be UTC. What could cause the scheduled action to trigger at the incorrect time like this?

1 Answers

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 - .

CDK does support specifying the timezone along with the cron expression -

answered a month ago
  • Actually, these cron expression are being generated by CDK using Schedule.cron(), and according to the documentation here: 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).

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions