• Home
  • Health
  • Software
  • Blog
  • aws

    AWS Cron Expressions

    It's similar to Linux cron, but there's a ? involved.


    They thought it would be too confusing to put * on both Day of Month (column 3) and Day of Week (column 5). So, one can be * but the other must be ?.


    # e.g.
    cron(0/5 * * * ? *)
         ^ every five minutes
             ^ every hour
               ^ every day of the month
                 ^ every month
                   ^ Day of week is unknown
                     ^ Every year
    
    # e.g. once an hour, but only at 12-6 PM UTC
    cron(0 8-17 * * ? *)
    
    # e.g. once an hour, but only at 12-6 PM UTC and only on Tuesdays
    cron(0 8-17 * * TUE *)
    
    # e.g. once an hour, but only at 12-6 PM UTC and only on Work days
    cron(0 8-17 * * MON-FRI *)
    


    Other examples:

    https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html