Search code examples
google-cloud-platformapi-gatewaygoogle-cloud-api-gateway

GCP: ERROR: (gcloud.services.enable) PERMISSION_DENIED: The caller does not have permission when enabling API


I am trying to use API Gateway, and I am not able to enable the apigateway.googleapis.com API. It is not shown in gcloud services list. I am trying to follow the instruction of gcp doc. https://cloud.google.com/api-gateway/docs/configure-dev-env#enabling_required_services

When trying to enable it in console, it does not return anything.

When trying to enable it in gcloud, it returns error as follows. gcloud services enable apigateway.googleapis.com ERROR: (gcloud.services.enable) PERMISSION_DENIED: The caller does not have permission

I was not able to attach a role since I was not able to find which role is related to apigateway. I could not create custom role since there was no related policy.

Is there any way I can resolve this issue?


Solution

  • To enable "API Gateway API" you need at least one of roles listed below:

    • Owner
    • Editor
    • Service Config Editor

    Next to enable the service you need to run:

    gcloud services enable apigateway.googleapis.com
    gcloud services enable servicemanagement.googleapis.com
    gcloud services enable servicecontrol.googleapis.com
    

    And the output should look somewhat like this:

    wb@cloudshell:~ (wojtek)$ gcloud services enable apigateway.googleapis.com
    Operation "operations/acf.f02abf75-b8c8-xxxx-b639-d1e69ed2c4c5" finished successfully.
    
    wb@cloudshell:~ (wojtek)$ gcloud services enable servicemanagement.googleapis.com
    Operation "operations/acf.faab3e15-7eb2-xxxx-8b34-2073f7f3518f" finished successfully.
    
    wb@cloudshell:~ (wojtek)$ gcloud services enable servicecontrol.googleapis.com
    Operation "operations/acf.faab3e15-7eb2-xxxx-8b34-2073f7f3518f" finished successfully.