Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide option to terminate after "X" minutes #395

Closed
JCapriotti opened this issue Apr 11, 2018 · 3 comments
Closed

Provide option to terminate after "X" minutes #395

JCapriotti opened this issue Apr 11, 2018 · 3 comments

Comments

@JCapriotti
Copy link
Contributor

I sometimes leave EC2 instances created by kitchen out there a little longer than planned. I was thinking it might be good to provide an option to terminate instances after a predetermined amount of time.

I have started working on this and have it partially completed. I'm looking for feedback to see if this seems like a good or bad idea before I get much farther.

Implementation-wise... here is what I'm looking at:

  • Create an option named terminate_after_minutes. Setting it to > 0 will cause a shutdown after that number of minutes.
  • When that new option is set, then instance_initiated_shutdown_behavior will override to terminate. That was my initial idea but after typing that out it might be better to leave this alone.
  • Linux instances will have a cron job that calls that executes at instance creation time + x minutes
  • Windows instances will have a Scheduled Task to do the same.
@coderanger
Copy link
Contributor

While I sympathize and would use the feature myself, I think this might be out of scope for us :/

@cheeseplus
Copy link
Contributor

Thats a bunch of work that kitchen itself really shouldn't be doing - internally at Chef we have reaper scripts and we enforce strict tagging rules to cull any errant instances or forgotten tk instances. We highly recommend that path as it's not exclusive to kitchen and especially on EC2 is easy to implement with lambdas.

I'm definitely of the "this is out of scope" mindset - the implementation across operating systems will be problematic and my concern is that instead of being a value add it'd add to the pile of edge case prone code we already maintain.

Totally sympathize here as well but firmly believe it's better to enforce this via another external mechanism. If the EC2 API itself supported some sort of time fuse for instances I could see this being viable but the idea of adding config to systems that chef or another provisioner could also be interacting with gives me the heebie jeebies when I think about possible bad interactions there.

@JCapriotti
Copy link
Contributor Author

Makes sense; I'll go down the road of using tags and some sort of script. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants