Search code examples
amazon-web-servicescron

AWS cron jobs to run every minute across a span of time across two hours?


I have a Lambda function on AWS scheduled using the following cron expression:

* 19-20 ? * SAT *

So it runs every minute from 19:00 - 20:59 on Saturdays. In reality, though, it really just needs to run from 19:50 - 20:30 on Saturdays, and my current setup is costing me money for no good reason. Is there any way to specify that with a cron expression (or is there another AWS scheduling mechanism I could use to accomplish this)?


Solution

  • I think you have to split it to two expressions:

    From 19:50-19:59:

    50/1 19 ? * SAT *
    

    From 20:00-20:30:

    0-30/1 20 ? * SAT *