Courseiva
Configuring Access and SecurityhardMultiple ChoiceObjective-mapped

Google ACE Configuring Access and Security Practice Question

A developer created a service account for an application running on a Compute Engine instance. The instance was started without specifying the service account. What must the developer do to make the application use the service account?

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

Stop the instance, update it with the --service-account flag using gcloud compute instances set-service-account, then start it.

If an instance is created without a service account, it uses the default compute engine service account. To use a custom service account, the instance must be created with '--service-account' flag. If already running, the instance must be stopped and the service account can be changed (attached) by updating the instance. The correct approach is to stop the instance, attach the service account, and restart.

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 iam service-accounts add-iam-policy-binding to grant the instance access.

    Why it's wrong here

    This command modifies the IAM policy that governs who can impersonate or manage the service account itself, granting roles on the service account resource. It does not cause a compute instance to assume that service account identity. The service account attached to an instance is a property of the instance resource, configured separately with set-service-account, not an IAM role binding.

  • Stop the instance, update it with the --service-account flag using gcloud compute instances set-service-account, then start it.

    Why this is correct

    Compute Engine requires an instance to be in the TERMINATED state before its service account can be changed, so you must stop the instance first. The gcloud compute instances set-service-account command updates the attached service account (and optionally the access scopes), and then you start the instance to apply the change. This approach preserves the existing VM, avoids resource recreation or workload migration, and is the documented way to attach a service account to an existing instance.

  • Use gcloud compute instances add-iam-policy-binding to assign the service account to the instance.

    Why it's wrong here

    The add-iam-policy-binding operation on an instance grants IAM principals permissions to perform actions on that instance resource, such as compute.instances.get or compute.instances.delete. It does not select or change the service account that the VM uses to authenticate outbound API calls. Assigning a service account to an instance is an attribute update performed via set-service-account, not a policy binding on the instance itself.

  • Create a new instance with the service account and migrate the application.

    Why it's wrong here

    Creating a new instance with the desired service account and migrating the application would eventually work, but it is a far heavier operation than necessary. It forces full VM re-creation, requires copying or reattaching disks, reconfiguring network interfaces, and risks downtime during migration. Since the existing instance can be updated in-place with set-service-account while stopped, the rebuild-and-migrate approach is unnecessary and not the recommended best practice.

About these practice questions

This ACE question is part of Courseiva's 769-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.