Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

273
Views
AWS cron expression to run every other Monday

I want to schedule a CloudWatch event to run every other Monday and have started with this command:

0 14 ? * 2 *

Currently with the above command, I get a weekly schedule of Monday executions:

Mon, 27 Jul 2020 14:00:00 GMT
Mon, 03 Aug 2020 14:00:00 GMT
Mon, 10 Aug 2020 14:00:00 GMT
Mon, 17 Aug 2020 14:00:00 GMT
Mon, 24 Aug 2020 14:00:00 GMT
Mon, 31 Aug 2020 14:00:00 GMT
Mon, 07 Sep 2020 14:00:00 GMT
Mon, 14 Sep 2020 14:00:00 GMT
Mon, 21 Sep 2020 14:00:00 GMT
Mon, 28 Sep 2020 14:00:00 GMT

However, I would like the schedule to be set to every other Monday, e.g.

Mon, 27 Jul 2020 14:00:00 GMT
Mon, 10 Aug 2020 14:00:00 GMT
Mon, 24 Aug 2020 14:00:00 GMT
Mon, 07 Sep 2020 14:00:00 GMT
Mon, 21 Sep 2020 14:00:00 GMT

I have seen examples with exp and # being used, but I don't think AWS CloudWatch events accept these sort of parameters.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You won't be able to do any of the fancier commands (especially those using variables from the command line).

You could do this very basically but would require 2 separate events in order to carry it out:

  • 0 14 ? * 2#1 * - Run on the first Monday of the month.
  • 0 14 ? * 2#3 * - Run on the third Monday of the month.

Unfortunately there is no compatible syntax for scheduled expressions that would allow the concept of every other week, so the above commands occasionally could lead to a 3 week gap.

If you don't care about the Monday you could of course use 0 14 1,15 * * to run on the 1st and 15th of each month (roughly every 2 weeks).

The final option would be to run every Monday, but have the script exit if it is not the every other week, the expression would then just be 0 14 ? * 2 *.

More information about the syntax is available on the Cron Expressions section of the Scheduled Events page.

over 4 years ago · Santiago Trujillo Report

0

Chris' answer is correct. Currently, there is no way that I could think of to express this as part of CloudWatch Scheduled Events.

However, a workaround could be to set it to every Monday (0 14 ? * 2 *) and trigger a Lambda function that checks whether it's in the on-week or the off-week before triggering the actual target.

Even though this adds some complexity, it would be a viable solution.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!