Schedules Wizard
EPAM Orchestrator has a convenient Web UI tool for schedule creation and management. Using the Schedules Wizard, you can set up and delete schedules and add instances to them.
To set up a new schedule, choose the 'Create new schedule' wizard option and select the schedule parameters - the project and region to which you wish the schedule to apply,
the action to be performed on schedule (you can choose between 'Start instances' and 'Stop instances'), the time and days of the week when the schedule is to be executed. Make sure you
give a name to the schedule and select the instances to be affected by it.
You can add instances to an existing schedule or remove them from a schedule. Select the 'Manage schedule instances' wizard option, find your schedule by the project ID, region and schedule
name and manage the affected instances by adding or removing them.
For detailed instructions on using the Schedules Wizard and the description of all available options, please visit the
Schedules Wizard page. For the information on configuring schedules using Maestro CLI,
please see below.
Related CLI Commands
The table below provides the list of service-related commands and their descriptions:
or2-create-schedule |
or2addsch |
Schedules a new action for the project and region |
or2-schedule-add-instances |
or2schaddi |
Adds an instance to the existing schedule |
or2-schedule-remove-instances |
or2schremi |
Removes an instance from the specified schedule |
or2-describe-schedules |
or2dsch |
Describes schedules existing for the specified project and region |
or2-delete-schedule |
or2delsch |
Deletes the specified schedule |
Further on this page, you can find the examples of the commands usage for CRON Service manipulation.
Scheduling Activation
Infrastructure scheduling is activated automatically as soon as the user specifies the schedule to be applied to the selected instances.
To set up a new schedule, use the or2-create-schedule (or2addsch) command with the following parameters:
or2addsch -p project -r region -a action -c cronExpression -i instance_id -n schedule_name
Here, the -a parameter specifies the action to be applied to the instances ('start', 'stop'), -c parameter specifies the Cron
expression used for scheduling the action, -i parameter specifies the instance or instances to which the schedule should be applied, and
the -n parameter sets the schedule name for further reference.
Below, you can see examples of the most typical schedules used to automate Cloud infrastructure manipulations:
-
To switch on the VM every morning and shut it down every evening on weekdays, use the following CLI Commands:
or2addsch -a start -c "0 0 5 ? * MON-FRI" -i instance_id -n on_schedule -p project -r region
or2addsch -a stop -c "0 0 15 ? * MON-FRI" -i instance_id -n off_schedule -p project -r region
The first schedule will start the VM at 8-00 Minsk time (UTC+3), and the second schedule will stop it at 18-00 Minsk Time (UTC+3)
-
To start the VM on Monday morning and stop it on Friday evening:
or2addsch -a start -c "0 0 5 ? * MON" -i instance_id -n start_schedule -p project -r region
or2addsch -a stop -c "0 0 15 ? * FRI" -i instance_id -n stop_schedule -p project -r region
The first schedule will start the VM on Mondays at 8-00 Minsk time (UTC+3), and the second schedule will stop it on Fridayes at 18-00 Minsk Time (UTC+3)
A schedule can be set for all instances within a region. For that purpose, use the or2addsch command with the --all parameter and omit the -i/--instance parameter:
or2addsch -p project -r region -a action -c cronExpression -n schedule_name --all
To create a schedule affecting only instances grouped by a certain principle, for example, only instances used for testing, use tags. Add tags to the corresponding instances and
set the schedule for them as follows:
or2addsch -p project -r region -n schedule_name -c cronExpression -t prefix:key=value
To add an instance or instances to an existing schedule, use the or2schedule-add-instances (or2schaddi) with the following parameters:
or2schaddi -p project -r region -i instance_id -n schedule_name
Instances cannot be added to or removed from schedules created for the entire region (with the --all option) or for instances with tags (with the -t/--tag option).
The details on the Cron rules creation are given in the section below.
Cron Reference
Below is an extract of cron rules, taken from quartz-scheduler.org. For additional information, please see the source page.
Cron expressions are comprised of 6 required fields and one optional field separated by white space. The fields respectively are described
as follows:
Seconds |
0-59 |
, - * / |
Minutes |
0-59 |
, - * / |
Hours |
0-23 |
, - * / |
Day-of-Month |
1-31 |
, - * ? / L W |
Month |
1-12 or JAN-DEC |
, - * / |
Day-of-Week |
1-7 or SUN-SAT |
, - * ? / L # |
Year (optional) |
empty, 1970-2199 |
, - * / |
The '*' character is used to specify all values. For example, "*" in the minute field means "every minute".
The '?' character is allowed for the day-of-month and day-of-week fields. It is used to specify 'no specific value'.
This is useful when you need to specify something in one of the two fields, but not the other.
The '-' character is used to specify ranges For example "10-12" in the hour field means "the hours 10, 11 and 12".
The ',' character is used to specify additional values. For example "MON,WED,FRI" in the day-of-week field means
"the days Monday, Wednesday, and Friday".
The '/' character is used to specify increments. For example "0/15" in the seconds field means "the seconds 0, 15, 30, and 45". And "5/15" in the
seconds field means "the seconds 5, 20, 35, and 50". Specifying '*' before the '/' is equivalent to specifying 0 is the value to start with.
The '/' character simply helps you turn on every "nth" value in the given set. Thus '7/6' in the month field only turns on month '7', it
does NOT mean every 6th month, please note that subtlety.
The 'L' character is allowed for the day-of-month and day-of-week fields. This character is short-hand for "last", but it has different meaning
in each of the two fields. For example, the value "L" in the day-of-month field means "the last day of the month" - day 31 for January,
day 28 for February on non-leap years. If used in the day-of-week field by itself, it simply means "7" or "SAT".
But if used in the day-of-week field after another value, it means "the last xxx day of the month" - for example "6L" means "the last Friday
of the month". You can also specify an offset from the last day of the month, such as "L-3" which would mean the third-to-last day
of the calendar month. When using the 'L' option, it is important not to specify lists, or ranges of values, as you'll get
confusing/unexpected results.
The 'W' character is allowed for the day-of-month field. This character is used to specify the weekday
(Monday-Friday) nearest the given day. As an example, if you were to specify "15W" as the value for the day-of-month field,
the meaning is:"the nearest weekday to the 15th of the month". So if the 15th is a Saturday, the trigger will fire on Friday the
14th.
The 'L' and 'W' characters can also be combined for the day-of-month expression to yield 'LW', which translates to "last weekday of the month".
The '#' character is allowed for the day-of-week field. This character is used to specify "the nth" XXX day of the month.
For example, the value of "6#3" in the day-of-week field means the third Friday of the month (day 6 = Friday and "#3" = the
3rd one in the month).
The legal characters and the names of months and days of the week are not case sensitive.
Describing Schedules
It is possible to see the list of the schedules executed for your project. To get such list, use the
or2-describe-schedules (or2dsch) CLI command with the following parameters:
or2dsch -p project -r region
Pricing
The Scheduling service is provided for free and is intended to help you optimize your infrastructure utilization and minimize the costs
through switching the VMs to passive state when they are not needed.
References
The detailed information on the commands used for infrastructure management scheduling can be found in
the "Scheduling Instance Activities" section of
Maestro CLI User Guide