Update strategies for MIG running behind Cloud Load Balancer

Manish Jindal
Google Cloud - Community
3 min readNov 30, 2022

This document describes different strategies for updating Instance Template version in an MIG running behind the cloud load balancer.

Compute engine maintains the VM in MIG based on the configuration specified in an Instance Template.

Let’s say you have a new version of Instance Template and you want to use this new version of Instance Template for all the VMs inside the MIG, this document describes three different strategies to upgrade your VMs inside the MIG.

  • Rolling Update
  • Canary Update
  • Blue/Green Update

Rolling Update

A basic rolling update is an update that is gradually applied to all instances in a MIG until all instances have been updated to the latest intended configuration. The rolling update automatically skips instances that are already in their latest configuration.

Rolling Update

Automatically apply VM configuration updates in a MIG | Compute Engine Documentation | Google Cloud

Canary Update

A canary update is an update that is applied to a subset of instances in the group. With a canary update, you can test new features or upgrades on a random subset of instances, instead of rolling out a potentially disruptive update to all your instances. If an update is not going well, you only need to roll back the subset of instances, minimising the disruption for your users.

Canary Update

Automatically apply VM configuration updates in a MIG | Compute Engine Documentation | Google Cloud

Blue/Green Update

A Blue/Green update is an update in which a new version of MIG is spinned up with the latest launch template and the number of instances in the MIG are of equal capacity of the existing MIG.

Since it is a blue/green update so instead of updating the instances in the MIG you change the entire MIG behind the load balancer.

Blue/Green

Steps to update the MIG using Blue/Green update:

  • Initially create a load balancer
  • Create an MIG (Blue)
  • Send 100% traffic to the Blue MIG.
Blue MIG
  • Spin up new MIG (Green) with the new Instance Template.
  • Update the load balancer’s backend configuration initially to send 0% traffic to this MIG.
  • Once the MIG is stable, update the load balancer’s backend to send 100% traffic to green MIG and delete the Blue MIG.

In Rolling/Canary update, VMs in the MIG are update to the new Instance Template version while in Blue/Green entire MIG is updated to the new Instance Template version and attached to the load balancer.

--

--