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

Default schedule for untagged resources

Open mrchops1024 opened this issue 5 years ago • 4 comments

From everything I've read about this solution, it relies on tagging in place to take action. I'd love to use this to control schedules via tags, but also apply a "default" schedule to untagged resources. So for example if a dev spins up an EC2 instances in one of our accounts, I'd like to be able to have a default schedule to apply (something like no startup, power off at 5pm).

I know I can enforce the Schedule tag but I feel like before I can do that I'd need a way to:

  1. Make the existing schedules available to see
  2. Provide a mechanism for folks to request creation of specific schedules that don't already exist

I know I can also write my own solution to handle this specific case, and then use this solution for specific schedules.

Anyone know if it's possible to use this solution on untagged resources?

mrchops1024 avatar Feb 07 '20 17:02 mrchops1024

Hi @mrchops1024

It does not seem like it is possible to do so as per your requirement. It fetches the instances and filters the instances based on the Schedule tag key which is the default tag key.

One of the alternative things that you can do in your case is that you can create a small python script which enforces the tag key and value as Schedule=default, tag on the instances and automatically puts upon those resources which do not have the Schedule tag. And you can create a default schedule in the instance scheduler config table as per your need. By using the lambda, you will not require an extensive tool and all the schedules will get maintain from a single instance scheduler.

Thank you

lovepurohit avatar Feb 17 '20 04:02 lovepurohit

Hi @mrchops1024 The solution does rely on resource tags in order to target actions being taken. As @lovepurohit mentioned, you could write a lambda funciton to add a default tag to all untagged resources or notify you via an SNS topic that an untagged resource has been found, allowing you to follow up with the developer. A CloudWatch rule can automatically invoke that function for you on a set interval.

I've added an item to our feature backlog for us to look into ways to make schedules available for view & request new ones.

ericquinones avatar Feb 18 '20 15:02 ericquinones

Thanks for the suggestions. I had actually started working on implementing something shortly after I submitted this. We use Organiations to manage multiple accounts so I'm working on getting a solution similar to what @lovepurohit suggested working with my account bootstrap template.

mrchops1024 avatar Feb 19 '20 23:02 mrchops1024

Please up-vote if you want this feature. Do not submit a new feature request.

maykays avatar Aug 21 '20 20:08 maykays