Hi everyone,
I'm trying to optimize our EC2 usage using AWS Instance Scheduler. Our EC2 usage is monday to friday, from 07:50 to 19:00 for which I have a working Instance Scheduler configuration that I'd like to fine-tune.
The goal is to avoid fixed bank holidays through the year, hence I was trying to apply multiple periods to a schedule, where each period models a month: a schedule s-office-hours
with two periods office-hours-apr
, office-hours-may
as shown below.
Schedule s-office-hours
scheduler-cli describe-schedules -s Instance-Scheduler --name "s-office-hours"
{
"Schedules": [
{
"UseMaintenanceWindow": false,
"StopNewInstances": true,
"UseMetrics": false,
"Hibernate": false,
"Timezone": "Europe/Rome",
"Enforced": false,
"RetainRunning": false,
"Periods": [
"office-hours-apr",
"office-hours-may"
],
"Name": "s-office-hours",
"Type": "schedule"
}
]
}
Periods office-hours-apr
scheduler-cli describe-periods -s Instance-Scheduler --name office-hours-apr
{
"Periods": [
{
"Begintime": "07:50",
"Monthdays": [
"26-30",
"1-24"
],
"Months": [
"4"
],
"Endtime": "19:00",
"Weekdays": [
"mon-fri"
],
"Name": "office-hours-apr",
"Type": "period"
}
]
}
Period office-hours-may
scheduler-cli describe-periods -s Instance-Scheduler --name office-hours-may
{
"Periods": [
{
"Begintime": "07:50",
"Monthdays": [
"2-3",
"5-31"
],
"Months": [
"5"
],
"Endtime": "19:00",
"Weekdays": [
"mon-fri"
],
"Name": "office-hours-may",
"Type": "period"
}
]
}
For some reason this configuration makes the scheduler not to work at all.
What I was able to retrieve from cloudwatch logs is the following message
WARNING : Skipping instance EC2:i-xxxx (debug-scheduler) in region eu-north-1 for account 1234567, schedule name "s-office-hours" is unknown
Where actually "s-office-hours" exists and is not mispelled anywhere (not even in EC2 tags)
I've googled a bit, and this message is shown when endtime comes before starttime, which does not apply to my case.
I suspect that could be smth related to conditions over Weekdays and Monthdays.
Can anyone help on this?