instance-scheduler-on-aws
instance-scheduler-on-aws copied to clipboard
Issue with Maintenance Window Feature - Instances Not Stopping
Good Morning,
Thank you for the work put into the project, it has been a great aid in our deployment.
We are keen to use the maintenance window feature to aid in patch management but are coming up against some issues.
The scheduler seems to create the schedules on-the-fly each time instance scheduler is invoked.
You can see the schedules created in the logs as expected.
2020-11-16 - 09:10:46.600 - INFO : Created schedule testmw from SSM maintence window, start is 2020-11-16T08:05:00+00:00, end is 2020-11-16T09:15:00+00:00
In this example, after 09:15 when the server should shut down the next schedule is generated instead, so the stop date from the previous schedule never occurs:
2020-11-16 - 09:15:47.337 - INFO : Created schedule testmw from SSM maintence window, start is 2020-11-16T08:05:00+00:00, end is 2020-11-16T09:15:00+00:00
Not sure if this is a bug or if we are doing something wrong, many thanks for any help
Hi @andycattle ,
Instances will be started based on the Frequency Interval specified in the Input parameter of the solution stack.
If the Frequency Interval is less than 10, Instances will be started 10 mins before the maintenance window and stopped at the end of maintenance window.
If the Frequency Interval is greater than 10, It will use Frequency interval value to start the maintenance window. for example, if Interval specified is 30, Instances will be started 30 mins before the maintenance window.
Also below are the limitation with Instance Scheduler.
- Maintenance window must exists in the same account and AWS Region as your deployed stack to schedule your Amazon EC2 instances
- Maintenance window created must use UTC time format.
Please let us know if this helps. Also can you please confirm the version of the Instance Scheduler deployed is latest.
Thanks, Praveen
Hi @praveenis,
Thank you for taking the time to get back to me, very much appreciated.
Having looked at this further, for our use case I think it's simpler just to define the maintenance windows as extra periods in the config table instead using the maintenance window feature.
In case it's useful to you I will confirm the details of our configuration:
Instance Scheduler Version:
1.3.3 (latest)
Config Table:
Schedule
Maintenance Window
Lambda Config:
ACCOUNT | XXXXXXXXXXXX
-- | --
BOTO_RETRY | 5,10,30,0.25
CONFIG_TABLE | AWSResearchInstanceScheduler-Oct05-2020-ConfigTable-G1JZ1236V0SZ
DDB_TABLE_NAME | AWSResearchInstanceScheduler-Oct05-2020-StateTable-1O3GIUECWXNE8
ENV_BOTO_RETRY_LOGGING | FALSE
ISSUES_TOPIC_ARN | arn:aws:sns:eu-west-1:XXXXXXXXXXXX:AWSResearchInstanceScheduler-Oct05-2020-InstanceSchedulerSnsTopic-AT66W1JEEF1M
LOG_GROUP | AWSResearchInstanceScheduler-Oct05-2020-logs
MAINTENANCE_WINDOW_TABLE | AWSResearchInstanceScheduler-Oct05-2020-MaintenanceWindowTable-894IHFCYUDRI
METRICS_URL | https://metrics.awssolutionsbuilder.com/generic
SCHEDULER_FREQUENCY | 5
SCHEDULER_RULE | aws-instance-schedulerscheduling_rule
SEND_METRICS | True
SOLUTION_ID | S00030
STACK_NAME | AWSResearchInstanceScheduler-Oct05-2020
STATE_TABLE | AWSResearchInstanceScheduler-Oct05-2020-StateTable-1O3GIUECWXNE8
TAG_NAME | Schedule
TRACE | False
USER_AGENT | InstanceScheduler-AWSResearchInstanceScheduler-Oct05-2020-v1.3.3
Thanks @andycattle for sharing the details. As I told before we have some limitation and defects using Maintenance window feature. We have this item in our backlog for future release to improve the usability of the feature.
@andycattle This maintenance window issue has be resolved in the v1.4.0 release, solution will fetch the maintenance window from the account + region where the ec2 instance is deployed.
I am still facing the same issue where the scheduler is unable to start instance. I am using Instance scheduler version 1.4.1.
Config
{ "type": { "S": "config" }, "name": { "S": "scheduler" }, "create_rds_snapshot": { "BOOL": false }, "default_timezone": { "S": "UTC" }, "enable_SSM_maintenance_windows": { "BOOL": true }, "regions": { "SS": [ "us-east-1" ] }, "scheduled_services": { "SS": [ "ec2" ] }, "schedule_clusters": { "BOOL": false }, "schedule_lambda_account": { "BOOL": true }, "started_tags": { "S": "instance-start=Scheduler" }, "stopped_tags": { "S": "instance-stop=Scheduler" }, "tagname": { "S": "Schedule" }, "trace": { "BOOL": true }, "use_metrics": { "BOOL": true } }
Scheduler:
{ "type": { "S": "schedule" }, "name": { "S": "uk-office-hours" }, "description": { "S": "Office hours in UK" }, "periods": { "SS": [ "office-hours" ] }, "ssm-maintenance-window": { "S": "demo" }, "timezone": { "S": "Asia/Calcutta" }, "use_maintenance_window": { "BOOL": true } }
@phanikumar1210 I had also tried Maintenance windows in instance scheduler but no success, I assume maintenance window feature is still broken or might be we are missing something that is not written in the documentation. @praveenis @andycattle Hi guys could you please look at this issue.