Running a lamba event on a cron schedule to start an EC2

0

Having issues making an event trigger in the lambda console. I have it selected for Eventbrtidge (CloudWatch)|schedule expression and have added this "cron(0 3 ** ** Sun-Thu *)" to run at 03:00 UTC Sunday to Thursday, also tried variations with ? for the month, and omitting the year, all with the same response.

But I get an error "Parameter ScheduleExpression is not valid. (Service: AmazonCloudWatchEvents; Status Code: 400; Error Code: ValidationException; Request ID: 300a10ad-4089-4990-91d6-553274289679; Proxy: null)" when I try to add it.

I've searched all the documentation and I've found some that says to omit the cron( ) wrapper if using the lambda console, but that fails the validation entirely, I checked the cron format and it matches all formatting I can locate.

Any ideas why I'm getting the error and what to do to resolve it ?

asked 3 years ago1109 views
1 Answer
0

Resolved this finally. The secrets are there is no seconds value in the cron, you must have the cron( ) wrapper. Day names must be all upper case, month only seems to work as ? and not **, and you must include ** for the year. Also all times are in UTC, not local zone time.

Got it working with cron(** ** 3 ? ** SUN-THU **)

answered 3 years ago

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