Manually Stopped instance during running hour is starting in next day
Hi,
I was testing this scheduler, Everything is working fine for me except on thing which is "If I manually stopping a instance in running hour then that instance is starting in next day", but as mentioned in this article it shouldn't start that instance because that instance was stopped in running hour.
Correct me if I am missing any configuration or is this a bug of this scheduler.
@piyushkumar8527 If you running hour is 24/7 and "enforced" field is set to false, then definitely Instance scheduler should not touch your ec2 instance.
@anuj1366 But my running hour is 9 AM to 6 PM, and I remember I tried doing enforced field as False but still that didn't work.
hi @piyushkumar8527
I do not believe that this is a bug with Instance Scheduler, though the wording may have been a little confusing.
Suppose you have a schedule that runs from 9am to 5pm every day. Under normal operation, Instance Scheduler will start the instance at 9am, and stop it again at 5pm. You can also take manual action to start the instance earlier than 9am and stop it earlier than 5pm and Instance Scheduler will not take any action that will prevent you from doing so. When the next day comes along, Instance Scheduler will continue scheduling the instance as normal.
However, if you enable the enforced flag on your schedule, Instance scheduler will recognize when an instance is started or stopped too early and will "enforce" the schedule by putting the instance back into the state specified by the schedule. For example, if you were to stop your instance at 2pm, instance scheduler would immediately restart it upon recognizing the discrepancy as the schedule specifies that running from 9am-5pm should be enforced.
Not taking this action to enforce the schedule is what the knowledge article was referring to by not starting an instance that you have stopped manually during a running period.
That said, Instance Schedule does provide behavior similar to what you initially described for running instances using the retain_running flag. If this flag is enabled and you manually start an instance outside of a scheduled running period, Instance Scheduler will disable scheduling on that instance until you manually stop it again. We do not currently have an equivalent feature for stopped instances however. In that scenario your best approach would be to simply remove the scheduling tag from the instance you wish to disable