Question

Difficulty: Very hardManaging Compute Engine Resources

Your organization needs to perform a zero-downtime update of a production stateless web application hosted on a Compute Engine Managed Instance Group (MIG). Place the operational steps in the correct sequential order to deploy the new application version according to Google Cloud best practices.

  1. 1Create a new Compute Engine instance template specifying the updated boot disk image and container configuration.
  2. 2Update the Managed Instance Group configuration to set the target instance template to the newly created instance template.
  3. 3Execute `gcloud compute instance-groups managed rolling-action replace` with designated `max-surge` and `max-unavailable` parameters.
  4. 4Monitor instance health checks and verify using `gcloud compute instance-groups managed list-instances` until all instances reach the `UPDATED` state.

Answer

The correct sequence for updating the Managed Instance Group with zero downtime is: 1) Create a new instance template containing the updated configuration, 2) Set the MIG target instance template to the new template, 3) Execute a rolling replace command with surge and unavailability constraints, and 4) Monitor instance health checks until all instances reach the UPDATED state.
Because Compute Engine instance templates are immutable, updating a Managed Instance Group (MIG) requires creating a new instance template first. Once created, the MIG target instance template reference must be updated to point to this new template. After updating the target reference, running a `rolling-action replace` command with defined `max-surge` and `max-unavailable` parameters starts the automated rollout while preserving application capacity. Finally, monitoring instance health checks ensures all new instances successfully serve traffic and transition to the `UPDATED` state.

Step-by-Step Solution

1
Create a new Compute Engine instance template
A new immutable template object is created containing the updated image and configuration.
Instance templates in Google Cloud are immutable and cannot be edited after creation.
2
Assign the new template to the Managed Instance Group
The MIG configuration points to the new template as its target resource.
The group must be explicitly configured to point to the new template before initiating rolling replacements.
3
Initiate rolling-action replace with surge controls
The MIG controller begins replacing old instances with new instances in batches.
Configuring max-surge and max-unavailable parameters ensures service capacity is maintained during the rollout.
4
Validate rollout completion via health status monitoring
All group instances complete transition to the target template and pass health checks.
Verifying instance health ensures application readiness before concluding the maintenance procedure.

Key Concept

Managed Instance Group (MIG) Rolling Updates and Instance Template Lifecycle Management
Rate this question