Courseiva
Deploying and Implementing a Cloud SolutionmediumMultiple ChoiceObjective-mapped

Google ACE Deploying and Implementing a Cloud Solution Practice Question

You have a managed instance group (MIG) with instances that need to run a startup script to configure monitoring agents. You created the instance template without a startup script. Which action should you take to add the startup script?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Create a new instance template with the startup script, then update the MIG to use the new template via a rolling update.

Instance templates are immutable; you cannot modify them. You must create a new instance template with the startup script and update the MIG to use it via rolling update or by setting the template.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Use gcloud compute instances add-metadata to add the startup script to each running instance.

    Why it's wrong here

    Adding metadata directly to a running instance is not a valid way to apply a startup script because startup scripts execute only during the instance boot process. Additionally, MIG-managed instances are considered declaratively managed by the group; any manual changes to them, including metadata, are overwritten if the instance is recreated to match the group's template, and this approach does not propagate the change to the MIG configuration. It also goes against the recommended pattern of using managed instance group updates.

  • Delete the MIG and recreate it with a new template; you cannot change the template of an existing MIG.

    Why it's wrong here

    Deleting the MIG and recreating it is unnecessary because an existing managed instance group can be updated to use a new instance template without being deleted. You can use the gcloud compute instance-groups managed set-instance-template command or a rolling update to change the template seamlessly. Recreating the entire MIG would cause downtime and require manually reconfiguring autoscaling, health checks, and other settings, violating best practices for managed instance groups.

  • Edit the existing instance template and add the startup script under 'metadata'.

    Why it's wrong here

    Instance templates are immutable resources in Compute Engine: after creation, you cannot edit or modify any field, including metadata or startup scripts. Even if you could, simply adding a startup script to the template would not affect existing instances in the MIG; it only applies to instances created afterward. Thus, this option fails both due to immutability and because it does not address the current running instances.

  • Create a new instance template with the startup script, then update the MIG to use the new template via a rolling update.

    Why this is correct

    The correct approach is to create a new instance template that includes the desired startup script in its metadata, then update the MIG to reference this new template using a rolling update. Since instance templates are immutable, creating a new template is mandatory. A rolling update (e.g., gcloud compute instance-groups managed rolling-action start-update) recreates the managed instances incrementally with the new template, ensuring the startup script executes during their boot. This method preserves availability and aligns with the MIG's declarative management model.

Go deeper

Related to this question

About these practice questions

Courseiva writes every ACE question from scratch — 769 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This ACE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the ACE exam.