Question

Difficulty: MediumEnabling and Managing Cloud Service APIs

An administrator needs to enable the Cloud Vision API (`vision.googleapis.com`) for a Google Cloud project named `media-proc-prod` using the `gcloud` command-line tool. Place the following steps in the correct sequential order from first to last to complete this configuration and verification process under least-privilege principles.

  1. 1Set the active `gcloud` configuration to target project `media-proc-prod` using `gcloud config set project media-proc-prod`.
  2. 2Ensure the administrator identity has the Service Usage Admin role (`roles/serviceusage.serviceUsageAdmin`) granted on project `media-proc-prod`.
  3. 3Execute `gcloud services enable vision.googleapis.com` to activate the API.
  4. 4Run `gcloud services list --enabled` to confirm that `vision.googleapis.com` is active.

Answer

The correct sequence is: First, set the active gcloud project context to media-proc-prod. Second, ensure the administrator identity has the Service Usage Admin role granted on the target project. Third, execute gcloud services enable vision.googleapis.com. Finally, run gcloud services list --enabled to confirm the API activation.
The workflow follows standard Google Cloud management practices: first configure project context in the CLI, ensure required permissions are present on the target project, execute the enablement command, and finally verify the resulting state.

Step-by-Step Solution

1
Set the project context in gcloud CLI.
The CLI environment now directs subsequent service usage requests to `media-proc-prod`.
Prevents accidentally enabling APIs in the wrong project or organization node.
2
Verify IAM role assignment for API management.
The user identity holds `roles/serviceusage.serviceUsageAdmin` privileges.
API enablement requires explicit IAM permissions such as `serviceusage.services.enable`.
3
Enable the Cloud Vision API service.
Google Cloud enables `vision.googleapis.com` for project `media-proc-prod`.
Invokes the core operation to register the project with the specific service API.
4
List enabled services using `gcloud services list --enabled`.
Output contains `vision.googleapis.com`.
Confirms operational readiness before dependent application workloads are deployed.

Key Concept

API Enablement and Verification Workflow using gcloud CLI
Estimated Time:1m 30s
Rate this question