aws-solutions / instance-scheduler-on-aws

A cross-account and cross-region solution that allows customers to automatically start and stop EC2 and RDS Instances
https://aws.amazon.com/solutions/implementations/instance-scheduler-on-aws/
Apache License 2.0
555 stars 279 forks source link

Instance Scheduler to create a schedule that would only stop instances on the weekends #586

Open exolain opened 4 hours ago

exolain commented 4 hours ago

We would like to the EC2 Instances on during the work week: come down on Friday, 8PM local time come up on Monday, 8AM local time

The closest option we found was:

Begin Time: 00:00
End Time: 23:59
WeekDays: mon-fri

But that would still stop the instances for 1 minutes on the weekdays.

Is there a way to only stop them from Friday 8pm to Monday 8am? Since the instance scheduler currently is designed based on when the instance can be running, this feature seems like it would be the opposite. But was wondering if something like this could be implemented somehow (maybe using a flag) in the future. Or if there is a way to achieve the above let me know. Thank you !

CrypticCabub commented 4 hours ago

The specific scenario you describe has an example of how to do it on our IG here: Stop Instances Over the Weekend

You are correct, however that Instance Scheduler does not play nicely with the idea of stop periods and there are other scenarios where it isn't possible to "declarethe inverse" as can be done here, so I will leave this issue open as a feature request that can be up-voted for enchancing the scheduling logic in this way

I do also want to call out that the scenario you provided will NOT stop instances for 1 minute at the end of each weekday. when periods are directly adjancent, we consider them 1 continuous running period and will not issue a stop action between them. mon-23:59 and tue-00:00 would also be considered directly adjacent for this purpose.