instance-scheduler-on-aws
instance-scheduler-on-aws copied to clipboard
Schedule is unknown
Hello, I deployed this solution with a central account managing various other accounts. Yesterday in testing, I configured a schedule and a TEST period. Once I validated that the instance in question stopped and started, I replaced the period in the schedule with the correct period (I duplicated the test period and modified only the start/stop times).
The job now fails, with the following error:
"WARNING : Skipping instance EC2:i-<id> (<instance_name>) in region us-east-1 for account <account_num>, schedule name \"amd-odbc-automation-schedule\" is unknown",
I have attempted to create the schedule entry via both DynamoDB directly, as well as using the CLI tool. I have confirmed that the tag applied to the instance is correct with no whitespace, either leading or trailing. Upon checking for schedule usage via the CLI, this particular schedule is not found while another is...
~ ➜ scheduler-cli --version
scheduler-cli v1.4.0
# The schedule is question is shown in describe-schedules
~ ✗ scheduler-cli describe-schedules --stack instance-scheduler-for-ec2-and-rds --region us-east-1 --profile admin-admin | jq '.Schedules[] | select(.Name == "amd-odbc-automation-schedule") | .'
{
"UseMaintenanceWindow": false,
"StopNewInstances": false,
"UseMetrics": false,
"Hibernate": false,
"Timezone": "US/Mountain",
"Enforced": false,
"RetainRunning": false,
"Periods": [
"amd-odbc-automation-period"
],
"Name": "amd-odbc-automation-schedule",
"Type": "schedule"
}
# But is not found when querying directly for it
~ ➜ scheduler-cli describe-schedule-usage --stack instance-scheduler-for-ec2-and-rds --region us-east-1 --profile admin-admin --name amd-odbc-automation-schedule
Not found: schedule amd-odbc-automation-schedule does not exist
# This schedule is found when using describe-schedules
~ ✗ scheduler-cli describe-schedules --stack instance-scheduler-for-ec2-and-rds --region us-east-1 --profile admin-admin | jq '.Schedules[] | select(.Name == "daily-eod-shutdown") | .'
{
"UseMaintenanceWindow": false,
"StopNewInstances": true,
"UseMetrics": false,
"Timezone": "US/Mountain",
"Hibernate": false,
"Enforced": false,
"RetainRunning": false,
"Periods": [
"daily-eod-shutdown"
],
"Name": "daily-eod-shutdown",
"Type": "schedule"
}
# And also found when querying directly for it
~ ➜ scheduler-cli describe-schedule-usage --stack instance-scheduler-for-ec2-and-rds --region us-east-1 --profile admin-admin --name daily-eod-shutdown
{
"Schedule": "daily-eod-shutdown",
"Usage": {
"2022-06-17": {
"RunningPeriods": {},
"BillingSeconds": 0,
"BillingHours": 0
}
}
}
I am at a loss for what is happening. I have entered and re-entered, deleted and re-created:
- schedule name
- entire schedule entry
- EC2 instance tag
Yet it continues to fail.
Here are some screenshots:

From the last screenshot, you can see that the state tag is set, which was done by the automation when it worked initially.
I'm at a loss. Guidance appreciated!
I (re-)re-created it via the scheduler-cli and it took this time. We can see my recreations were identical.
Still lost, but happy that I won't break a scheduled task like I did this morning.
I lied - I changed one more thing... I removed the endtime on the single period to ensure that recreating the schedule didn't turn off an instance that was actively being used. That was what fixed the error. Readding the 02:00 end time is what is breaking it.
This is what the period looks like:
{
"Begintime": "23:30",
"Endtime": "02:00",
"Description": "Time frame that AMD ODBC Server script runs",
"Weekdays": [
"wed",
"sat",
"tue",
"thu",
"mon",
"sun",
"fri"
],
"Name": "amd-odbc-automation-period",
"Type": "period"
}
When I remove the endtime, it works. When I add it, it gives me the schedule unknown error.
How can I structure this? Would it be something like this?
~ ➜ scheduler-cli describe-periods
...
{
"Begintime": "23:30",
"Description": "Time frame that AMD ODBC Server script runs",
"Weekdays": [
"wed",
"sat",
"thu",
"tue",
"sun",
"mon",
"fri"
],
"Name": "amd-odbc-automation-start-period",
"Type": "period"
}
{
"Description": "Time frame that AMD ODBC Server script runs",
"Endtime": "02:00",
"Weekdays": [
"wed",
"sat",
"thu",
"tue",
"sun",
"mon",
"fri"
],
"Name": "amd-odbc-automation-stop-period",
"Type": "period"
}
...
I guess I see two other solutions:
- Change the scheduled job to not start at midnight, but instead a time where start/stop could exist on the same day.
- Change the schedule to use UTC.
The End time cannot be earlier than the Start time for a period. A workaround for this is to use a timezone and make sure that End time is not earlier than start time on a given day.