Question

Difficulty: EasyEnabling and Managing Cloud Service APIs

An administrator needs to enable the Kubernetes Engine API (`container.googleapis.com`) for a Google Cloud project named `analytics-prod` using the `gcloud` CLI. Which TWO of the following requirements or actions are necessary to successfully enable the service API on the targeted project?

  1. Specify the target project `analytics-prod` explicitly in the `gcloud services enable` command or set it as the active default project in `gcloud config`.Answer
  2. Ensure the identity executing the command holds the Service Usage Admin (`roles/serviceusage.serviceUsageAdmin`) role or equivalent API enablement permissions on project `analytics-prod`.Answer
  3. C
    Enable the API at the Google Cloud Organization node level so that all child projects automatically inherit the enabled state.
  4. D
    Grant the basic Viewer (`roles/viewer`) role to the identity executing the `gcloud` command.

Answer

To enable a Google Cloud API on a specific project, you must target the correct project (via `gcloud` flags or configuration) and possess adequate permissions such as the Service Usage Admin role on that project.
Enabling a service API requires both administrative IAM permissions (such as Service Usage Admin) on the target project and directing the `gcloud` CLI command specifically to that project context.

Step-by-Step Solution

1
Identify the required IAM permissions for enabling APIs.
The identity running the command requires permissions contained in roles like Service Usage Admin (`roles/serviceusage.serviceUsageAdmin`).
Enabling service APIs requires modifying project resource configurations via the `serviceusage.services.enable` permission.
2
Target the specific project where the API service should run.
The CLI command must include `--project=analytics-prod` or have `analytics-prod` configured as the default project.
Google Cloud service APIs are enabled at the individual project scope, not globally or hierarchically across the organization.

Key Concept

API Enablement Scoping and IAM Requirements
Estimated Time:1m 0s
Rate this question