amazon-cloudwatchamazon-cloudwatch-events

Setting Cloudwatch Event Cron Job


I'm a little bit confused on the cron job documentation for cloudwatch events. My goal is to create a cron job that run every day at 9am, 5pm, and 11pm EST. Does this look correct or did I do it wrong? It seems like cloudwatch uses UTC military time so I tried to convert it to EST. I thought I was right, but I got the following error when trying to deploy cloudformation template via sam deploy

Parameter ScheduleExpression is not valid. (Service: AmazonCloudWatchEvents; Status Code: 400; Error Code: ValidationException

What is wrong with my cron job? I appreciate any help!

(SUN-SAT, 4,0,6)

UPDATED:

this below gets same error Parameter ScheduleExpression is not valid

 Events:
        CloudWatchEvent:
          Type: Schedule
          Properties:
            Schedule: cron(0 0 9,17,23 ? * * *)
      MemorySize: 128
      Timeout: 100

Solution

  • You have to specify a value for all six required cron fields

    This should satisfy all your requirements:

    0 4,14,22 ? * * *
    

    Generated using: https://www.freeformatter.com/cron-expression-generator-quartz.html

    There are a lot of other cron generators you can find online.