Innablr / revolver

AWS Powercycle Facility
MIT License
2 stars 3 forks source link

Ability to terminate ASG members, rather than just stop them #277

Open lyricnz opened 7 months ago

lyricnz commented 7 months ago

At the moment, Revolver stops EC2 instances that are members of ASGs, before pausing the ASG. It would be beneficial if Revolver could terminate the instances to remove parasitic cost (EIP, EBS volumes and snapshots)

lyricnz commented 7 months ago

This will be a little challenging because Revolver doesn't really have a ASG resource - it kindof magically uses them when it finds EC2 that are members of ASGs. If revolver terminates the EC2s it won't find them anymore, so won't even notice the ASGs.

lyricnz commented 7 months ago

Maybe... if instances are terminated, we could make "virtual" InstrumentedEc2 to represent instances in paused ASGs? The virtual-EC2 wouldn't support EC2 start/stop commands, but could still allow the ASG-resume to happen.

The properties of the virtual-EC2 could be built from either one of the instances before shutdown, or synthetically from the ASG Launch Template + ASG overrides/tags.

Any better ideas @abukharov @alutman-innablr ? Customer really wants to terminate, not pause, because the instances have really large EBS volumes (with disposable content).

lyricnz commented 3 months ago

Also, customer has some ASG where they use step functions to install/startup the instances properly, so just restarting the VMs won't work.

lyricnz commented 3 weeks ago

One solution to this could be to modify the ASG parameters to allow it to scale to zero, then restore the old values when the shutdown period exits. Would need a reliable place to store the previous configuration, as Revolver may not have access to modify the ASG to add metadata. We would need an option to preserve the current behaviour (for the pro-pet anti-cattle customers)