Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue with AWS Instance Scheduler - schedule name is unknown

I'm having some issues with the AWS Instance Scheduler. I have followed the setup guides provided by AWS and believe to have followed them correctly. However, the schedules are not working and the log files state:

WARNING : Skipping instance EC2:i-******* in region eu-west-2 for account *******, schedule name "uk-office-hours" is unknown

My "period" configuration is set to start the instances at 08:00 and stop the instances at 18:00 Monday to Friday:

{
  "begintime": {"S": "08:00"},
  "description": {"S": "Office Hours UK"},
  "endtime": {"S": "18:00"},
  "name": {"S": "uk-office-hours"},
  "type": {"S": "period"},
  "weekdays": {"SS": ["mon-fri"]}
}

Here is the "schedule" configuration:

{
  "description": {"S": "Office hours in UK"},
  "name": {"S": "uk-office-hours"},
  "periods": {"SS": ["uk-office-hours"]},
  "timezone": {"S": "Europe/London"},
  "type": {"S": "schedule"}
}

I have tried playing around with the "config" and tag names, the scheduler does seem to be running at the required intervals but cannot find the schedule. I have tried playing around with the "period" and the "schedule" configuration names but still no joy.

I have also created "schedules" and "periods" using the scheduler-cli but I am receiving the same responses. I can query all schedules using the CLI and listed within the response but when retrieving the schedule by name then it cannot be found.

# scheduler-cli describe-schedule-usage --stack InstanceScheduler --region eu-west-2 --name uk-office-hours
Not found: schedule uk-office-hours does not exist

Am I missing something? Any help is highly appreciated.

like image 803
Tom Jones Avatar asked Nov 22 '25 02:11

Tom Jones


2 Answers

In my opinion, we can use CloudWatchLog to check the config

CloudWatch > CloudWatch Logs > Log Groups > (your schedule logs)

  • CloudWatchEventHandler: shows Error if there are some incorrect part on the config
  • InstanceScheduler: if there are no errors, instanceScheduler's DEBUG part shows all your schedules and periods. If there are some missed items, it means those items have incorrect part.

At the first time, I got the same message from Scheduler-ec2-xxxx "Not found: schedule xxxx does not exist" also I couldn't see my custom schedule and period on the InstanceScheduler DEBUG part. CloudWatchEventHandler showed ERROR about time and timezone format, and after fixed it, those things were displayed on InstanceScheduler DEBUG part, and working fine with EC2 and RDS.

like image 140
Noah Gray Avatar answered Nov 24 '25 23:11

Noah Gray


I think I might have found a solution, the "schedule" didn't like the single "period" so I created a start and start period....

schedstart

{
  "begintime": {
    "S": "08:00"
  },
  "endtime": {
    "S": "23:59"
  },
  "name": {
    "S": "schedstart"
  },
  "type": {
    "S": "period"
  },
  "weekdays": {
    "SS": [
      "mon-fri"
    ]
  }
}

schedstop

{
  "begintime": {
    "S": "00:00"
  },
  "endtime": {
    "S": "18:00"
  },
  "name": {
    "S": "schedstop"
  },
  "type": {
    "S": "period"
  },
  "weekdays": {
    "SS": [
      "mon-fri"
    ]
  }
}

schedstop

{
  "description": {
    "S": "Office hours in UK"
  },
  "name": {
    "S": "uk-office-hours"
  },
  "periods": {
    "SS": [
      "schedstart",
      "schedstop"
    ]
  },
  "timezone": {
    "S": "Europe/London"
  },
  "type": {
    "S": "schedule"
  }
}

Please let me know if you have a better solution!

like image 29
Tom Jones Avatar answered Nov 24 '25 21:11

Tom Jones



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!