Schedule Cron expression not valid? - amazon-web-services

I'm creating an AWS CloudWatch rule, using the Schedule Cron expression: 30 10 * * 2,5 *, namely - every Tuesday and Friday on 10:30 UTC.
However, AWS gives me
There was an error while saving rule Snapshot_EBS_disk.
Details: Parameter ScheduleExpression is not valid..
Any idea what's wrong with my expression?

One of day-of-month or day-of-week must be ?. So to make your cron expression valid you would use the following:
30 10 ? * 3,6 *
Also note that Tuesday and Friday are 3 and 6 respectively

Related

AWS cron every Sunday and Wednesday

How can I run a cron job at 2am UTC at every Sunday and Wednesday on AWS.
0 2 * * SUN,WED *
The time is fine, just the days seem to be the wrong format (getting Parameter ScheduleExpression is not valid via serverless). But all resources I can find do only state ranges of days, how to select single ones?
Your cron should look like this:
0 2 ? * SUN,WED *
Or:
0 2 ? * 1,4 *
^
Day of month is wrong
Your issue is with the Day of month.
Check the result in EventBridge

Cron Expression in aws weekly

Is it possible to create a cron in AWS CloudWatch that runs every hour from 9:30 a.m. to 4:30 p.m. Monday through Friday?
In the documentation here, the closest example I have is this:
0/5, 8-17, ?, *, MON-FRI, * = Run every 5 minutes Monday through Friday between 8:00 am and 5:55 pm (UTC+0).
from the example above, where is it defined that it will end at "55 "minutes after "5" hours? Ignoring that, something like this occurs to me:
0/60, 9-16, ?, *, MON-FRI, *
but I'm not sure what it means or if it's correct, also it's not starting from 9:30 but from 9:00
I hope you can help me, thanks in advance
I used this calculator to verify and generate cron expressions.
In the example you provide 0/5, 8-17, ?, *, MON-FRI, *
0/5:- means it runs every five minutes starting at 00 minutes (00
minutes inclusive)
8-17:- means it runs between 8 and 17 hours with both 8 and 17
inclusive.
So For your use case:- 0, 10-16, ?, *, MON-FRI, *
(since hours between 9.30 - 4.30 are 10-16 and it only needs to run at the start of the hour which means 00 minutes)

AWS SSM CRON ISSUE - InvalidSchedule: Schedule expression cron(0 11 ? * MON-FRI *) is currently not accepted

I'm getting the following error when I try to create a state manager association using cron:
InvalidSchedule: Schedule expression cron(0 11 ? * MON-FRI *) is currently not accepted. Supported expressions are every half, 1, 2, 4, 8 or 12 hour(s), every specified day and time of the week. Supported examples are: cron(0 0/30 * 1/1 * ? *), cron(0 0 0/4 1/1 * ? *), cron (0 0 10 ? * SUN *), cron (0 0 10 ? * * *)
The cron syntax that I'm using is the following:
cron(0 11 ? * MON-FRI *)
According to the documentation the cron syntax is correct:
Cron expression examples
6:00 PM Monday through Friday
cron(0 18 ? * MON-FRI *)
Any thought about it? Maybe SSM is not allowed to execute cron job with more than one day on the syntax

Coldfusion 10 scheduled task cron time for every 15 minutes but only on Tuesdays

Trying to setup a scheduled task in CF10 (Standard) to run every 15 minutes but only on Tuesdays. A cron created said this would do the job:
*/15 * * * 2
But that gives the error "An error occured scheduling the task.
Unexpected end of expression." I also tried
15 * * * 2
The notes say 6 or 7 space separated fields - what am I missing? Minute, hour, day of month, month, day of week is 5 fields.
The representation is in the below format:-
Seconds Minutes Hours Day-of-Month Month Day-of-Week Year (optional
field)
So, for a task to run every 15 minutes but only on Tuesdays, below is the CRON.
"0 0/15 * ? * TUE".
You can refer to the link below for more details:
http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/tutorial-lesson-06

Is it possible to set up Amazon EC2 auto-scaling for particular days of the week?

I need to have a different auto-scaling policy for weekdays vs weekend.
So far I figured out how to set up the same policy for every day. The cmd call and the CRON string look like that:
as-put-scheduled-update-group-action TNUPWN --auto-scaling-group TNASG --region us-west-2 --recurrence "30 18 * * *" --desired-capacity 1
But when I try to set a CRON string for week days only e.g.
30 7 ? * MON-FRI *
or
0 30 7 ? * MON-FRI *
I am getting the error
as-put-scheduled-update-group-action: Malformed input-Given recurrence string:30 1 ? * MON-FRI * is
invalid
Usage:
as-put-scheduled-update-group-action
ScheduledActionName --auto-scaling-group value [--desired-capacity
value ] [--end-time value ] [--max-size value ] [--min-size value ]
[--recurrence value ] [--start-time value ] [--time value ]
[General Options]
Any ideas? Is it even possible with AWS?
The problem is that AWS only supports the 5 digit notation as opposed to the 6 digit notation in your example.
The AWS official blog announcement links directly to the Wikipedia page for cron which has the 5 digit notation at the top.
Your schedule corrected:
30 7 ? * MON-FRI
I think the problem is with your cron string. Try using digits (instead of day abbreviations).
Also, you could implement it this way:
Setup scheduled group action for every Friday at midnight to increase capacity.
--recurrence 0 0 * * 5 *
Setup scheduled group action for every Sunday at midnight to reduce capacity.
--recurrence 0 0 * * 7 *
This article has some sample commands with properly formatted cron strings:
http://www.newvem.com/how-to-configure-aws-cloud-auto-scaling-to-scale-based-on-a-schedule/
And here is a cron format reference:
http://www.nncron.ru/help/EN/working/cron-format.htm
If it helps anyone else, I had the following Cron strings rejected:
0 0 1 1/1 * ? TUE-SAT
0 0 1 1/1 * ? Tue-Sat
0 0 1 * * ? Tue-Sat
0 1 ? * TUE-SAT
All of these had been found valid by this online utility: http://cronexpressiondescriptor.azurewebsites.net
Finally, it worked with this one:
0 1 * * TUE-SAT
So AWS must have their own particular syntax.