0

How to setup GCE autoscaling for instance group basing on the amount of running VMs in another instance group. I have 'main-instance-group' with its own scaling policies. I want the second instance group 'additional-instance-group' to scale from 0 to 1 when there is no running VMs inside 'main-instance-group'.

Is it possible to achieve this using Stackdriver Monitoring metrics?

I've found pretty close metric named compute.googleapis.com/instance/uptime and it goes to 0 when there are no instances inside 'main-instance-group'. But as far as I see only possible ways to scale up are stackdriver-metric-single-instance-assignment and stackdriver-metric-utilization-target both of them doesn't match my case as far as they require some non zero targets to match.

Grzenio
  • 35,875
  • 47
  • 158
  • 240

1 Answers1

0

I do not believe this is possible.

I had managed to create a metric that would count the amount of VM's in an instance group but I was then unable to select that metric in the managed instance group metric selection menu.

Alexandre
  • 77
  • 7
  • can you please share how did u able to created this metric ? – Tal Ben Shabtay Nov 18 '19 at 14:30
  • hey, its kinda janky but I created a metric with the resource: GCE=vm instance, Metric=cpu usage, filter="tag associated with my instance group" and count as an aggregator. it gives you an answer in seconds but it will provide you with the ammount of VMs in an instance group – Alexandre Nov 20 '19 at 00:58