gcloud services enable: APIs & Common CI Errors
Enable the Google Cloud APIs your services and pipelines depend on.
gcloud services enable activates a Google Cloud API on a project. Most "API has not been enabled" failures are fixed by enabling the right service before the command that needs it.
What it does
gcloud services enable <api> turns on one or more APIs (services) for the active project so their resources can be created and called. You can enable several at once, and gcloud services list --enabled shows what is already on. Enabling is idempotent - re-enabling an active API is a no-op.
Common usage
# Enable several APIs needed for a Cloud Run + build pipeline
gcloud services enable \
run.googleapis.com \
cloudbuild.googleapis.com \
artifactregistry.googleapis.com
# List enabled APIs
gcloud services list --enabledCommon error in CI: PERMISSION_DENIED / API enablement is eventually consistent
Enabling fails with "PERMISSION_DENIED ... serviceusage.services.enable" when the identity lacks roles/serviceusage.serviceUsageAdmin, or a follow-up command still reports the API as disabled because enablement takes a short time to propagate. Fix: grant the CI identity serviceusage.serviceUsageAdmin (or run enablement once via an admin identity in setup, not on every deploy); after enabling, allow a brief delay/retry before the first call that uses the API. Use the exact service name (e.g. run.googleapis.com).
Key options
| Command / arg | Purpose |
|---|---|
| SERVICE... | One or more API service names |
| --project | Target a specific project |
| services list --enabled | Show enabled APIs |
| services disable | Turn an API off |