instance-scheduler-on-aws icon indicating copy to clipboard operation
instance-scheduler-on-aws copied to clipboard

no-schedule tag on Instance Scheduler

Open anuj1366 opened this issue 3 years ago • 8 comments

Hello,

Is there a way to define a tag or period that does not schedule instance? We want to introduce the tag key as a mandatory value. Customer want to run their ec2 instances 24/7. But if they have manually stopped the instance for some reason, Instance scheduler doesn't start the instances.

Thank you

anuj1366 avatar Aug 17 '22 13:08 anuj1366

It is similar to https://github.com/aws-solutions/aws-instance-scheduler/issues/259, but one additional requirement like if ec2 stopped manually, it should not be started by Instance Scheduler. For this I have modified the "Enforced" to false in below configuration

{
         "UseMaintenanceWindow": false,
         "StopNewInstances": false,
         "UseMetrics": false,
         "Hibernate": false,
         "Timezone": "UTC",
         "Enforced": true,
         "RetainRunning": true,
         "Description": "Keep instances running",
         "Periods": [
            "entire-day"
         ],
         "Name": "running",
         "Type": "schedule"
}

and Period as

{
         "Begintime": "00:00",
         "Description": "Running for the entire duration of the week.",
         "Endtime": "23:59",
         "Weekdays": [
            "mon-sun"
         ],
         "Name": "entire-day",
         "Type": "period"
      }

But Somehow the configuration is not working and manually stopped ec2 instances are getting started by instance scheduler. @gockle Could you please help me in this scenario.

anuj1366 avatar Aug 19 '22 10:08 anuj1366

I am seeing one issue here As per document if I have set Enforced field = false, then Instance scheduler should not start an instance if it was manually stopped during a running period( and we have set running period 24/7). but in our case it is starting the instances.

Enforced field Schedules contain an enforced field that allows you to prevent an instance from being manually started outside of a running period, or manually stopped during a running period. If this field is set to true and a user manually starts an instance outside of a running period, the solution will stop the instance. If this field is set to true, it also restarts an instance if it was manually stopped during a running period.

anuj1366 avatar Aug 19 '22 11:08 anuj1366

Hi @anuj1366 ,

I am also stuck in the same situation where if instance is manually stopped then instance scheduler should not start ec2 next day but it is starting it.

Were you able to find any workaround for this?

piyushkumar8527 avatar Aug 30 '22 20:08 piyushkumar8527