Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Automate deletion of VM instance from MIG

I am looking for automating the process for removal of VM instances from MIG if it reaches memory or CPU utilization threashold . Any help will be appreciated. 

2 1 100
1 REPLY 1

Hello @Arkya  ,Welcome on Google Cloud Community.

Such usage is hmm against the MIG purpose. You should use MIGs if you can't predict the load and you need scalability. If you want to keep number of VMs as low as possible, reduce instance count to 1. If load will be higher than threshold, add VM. But if load will be decreased ( means total utilization counted from ALL instances will be lower than threshold ) autoscaler will remove VM. There is no point from my perspective to try remove VM from MIG if it reach CPU or MEM utilization threshold. Or maybe I don't getting the point of such approach. If yes, please correct me if I'm wrong 🙂

PS: If you will setup properly autoscaling and scale-in control, you should be able to achieve your goal. 
More info here: https://cloud.google.com/compute/docs/autoscaler?_gl=1*kntwc2*_ga*OTQxMjM5MjU3LjE3MTM4NTQzNjU.*_ga_W...

 

DamianS_0-1721415303446.png

 

--
cheers,
DamianS
LinkedIn medium.com Cloudskillsboost