App Engine Standard Auto Scaling - How to stop previous version on deployment?

After reading the documentation more, I think I found the fix. I removed min_instances and left in min_idle_instances. Since min_instances forces the instances to be live regardless of traffic, and min_idle_instances only applies to the version receiving most of the traffic. I am testing this, will report back if this does not work.

https://cloud.google.com/appengine/docs/standard/nodejs/config/appref#automatic_scaling

min_instances

The minimum number of instances for App Engine to create for this module version. These instances serve traffic when requests arrive, and continue to serve traffic even when additional instances are started up as required to handle traffic. Note that you are charged for the number of instances specified whether they are receiving traffic or not.

min_idle_instances

The number of instances to be kept running and ready to serve traffic. Note that you are charged for the number of instances specified whether they are receiving traffic or not. This setting only applies to the version that receives most of the traffic.


App Engine standard instances can not be stopped as mentioned here unless you are using either Manual or Basic Scaling. This would mean that if for some reason someone is able to reach the URL of your previous version, it will start an instance in order to serve said request.

My recommendation would be to change to a different type of scaling (personally I would choose Basic Scaling for your case) as you would be able to stop the instances. Otherwise, you would have to delete the previous versions or run the risk of an instance running on an old version without your knowledge due to some random request to an older version.

Hope you find this information helpful.