GCP Associate Cloud Engineer Practice Question 51: Enable API New Project

Google Cloud Associate Cloud Engineer · Test 6 · question 1 of 10

gcloud CLIeasy

A team creates a brand new Google Cloud project and immediately tries to run gcloud compute instances create from Cloud Shell. The command fails with an error stating that the Compute Engine API has not been used in the project or is disabled. What should the team do to resolve this before retrying the command?

Select one answer
Show answer and explanation

Answer:

  • A. Run gcloud services enable compute.googleapis.com to enable the Compute Engine API for the project.

New Google Cloud projects start with most APIs disabled. Before a service can be called, its API must be explicitly enabled for that project, either from the Cloud Console's API Library or with gcloud services enable SERVICE_NAME. The exact error the team hit ("has not been used in project ... or it is disabled") is Google's standard API_NOT_ENABLED message, and it is resolved by enabling the specific API involved, here compute.googleapis.com.

B is wrong because the error is about the API being disabled at the project level, not about the caller's permissions; an IAM role change does not turn on a disabled API. C is wrong because linking a billing account is required for many services to run workloads, but it does not automatically enable individual APIs, and there is no 24 hour activation delay tied to billing. D is wrong because Compute Engine does not require a custom VPC before its API can be used; every project ships with a default auto mode network, and in any case a missing network would produce a different error, not an "API not enabled" message.

Reference: Enabling and disabling services

Practice Test 6 ›

Study guides for Google Cloud Associate Cloud Engineer