A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/api-gateway/docs/deploying-api below:

Deploying an API to a gateway | API Gateway Documentation

Stay organized with collections Save and categorize content based on your preferences.

Deploying an API to a gateway Prerequisites

Before you can deploy an API config on API Gateway, ensure that you have:

Gateway ID requirements

Many of the gcloud commands shown below require you to specify the ID of the gateway, in the form: GATEWAY_ID. API Gateway enforces the following requirements for the gateway ID:

Defining the endpoint of the deployed API config

When you deploy an API config to a gateway, API Gateway creates a unique URL for the gateway in the gateway.dev domain. Your API clients then use a URL in the form below to access the deployed API config:

https://GATEWAY_ID-HASH.REGION_CODE.gateway.dev

where GATEWAY_ID is the name of the gateway, HASH is the unique hash code generated when you deployed the API, and REGION_CODE is the code for the Cloud location in which you deployed the gateway.

For example:

https://my-gateway-a12bcd345e67f89g0h.uc.gateway.dev
Deploy an API config to a gateway

Use the Google Cloud CLI to deploy an API config to a gateway. When you deploy the API config, you are required to specify the name of the API. If the gateway does not already exist for the API, then this command also creates it.

To deploy an API config to a gateway:

  1. Validate the project ID returned from the following command to make sure that the gateway isn't created in the wrong project.

    gcloud config list project

    If you need to change the default project, run the following command and replace PROJECT_ID with the Google Cloud project ID in which you want to create the service::

    gcloud config set project PROJECT_ID
  2. View help for the gateway create command:

    gcloud api-gateway gateways create --help
  3. Run the following command to deploy the API config to the gateway:

    gcloud api-gateway gateways create GATEWAY_ID \
      --api=API_ID --api-config=CONFIG_ID \
      --location=GCP_REGION --project=PROJECT_ID

    where:

    As it is creating the gateway, gcloud outputs information to the terminal.

  4. On successful completion, you can use the following command to view details about the gateway:

    gcloud api-gateway gateways describe GATEWAY_ID \
      --location=GCP_REGION --project=PROJECT_ID

    This command returns the following:

    apiConfig: projects/PROJECT_ID/locations/global/apis/API_ID/configs/CONFIG_ID
    createTime: '2020-02-05T13:44:12.997862831Z'
    defaultHostname: my-gateway-a12bcd345e67f89g0h.uc.gateway.dev
    displayName: GATEWAY_ID
    name: projects/PROJECT_ID/locations/GCP_REGION/gateways/GATEWAY_ID
    serviceAccount:
      email: gateway-111111@222222-tp.iam.gserviceaccount.com
    state: ACTIVE
    updateTime: '2020-02-05T13:45:00.844705087Z'

    Note the value of the defaultHostname property. This is the hostname portion of the gateway URL. To access an API config deployed to this gateway, you use a URL in the form:

    https://my-gateway-a12bcd345e67f89g0h.uc.gateway.dev

The Google Cloud CLI takes many options, including those described in the gcloud Reference. In addition, for API Gateway, you can set the following options when creating a gateway:

Listing gateways

To list gateways for a specific project:

gcloud api-gateway gateways list --project=PROJECT_ID

This command returns output in the form:

GATEWAY_ID        LOCATION       DISPLAY_NAME     STATE     CREATE_TIME          UPDATE_TIME
my-gateway        us-central1    my-gateway       ACTIVE    2021-01-07T00:04:19  2022-05-21T00:33:46

To list gateways for a specific project and region:

gcloud api-gateway gateways list --location=GCP_REGION --project=PROJECT_ID

Use a filter expression to list the gateways associated with a specific API:

gcloud api-gateway gateways list \
  --filter="apiConfig:projects/PROJECT_ID/locations/global/apis/API_ID/*" \
  --project=PROJECT_ID

Or use this filter to list gateways for a specific API config:

gcloud api-gateway gateways list \
  --filter="apiConfig:projects/PROJECT_ID/locations/global/apis/API_ID/configs/CONFIG_ID" \
  --project=PROJECT_ID

Use the project, region, and gateway IDs to obtain detailed information about the gateway, including the identity of the API config deployed to the gateway:

gcloud api-gateway gateways describe GATEWAY_ID \
  --location=GCP_REGION --project=PROJECT_ID
Updating a gateway

Update a gateway to:

Use the following gcloud command to update an existing gateway, where UPDATE_OPTIONS is replaced with the gateway option flag and value you wish to update:

gcloud api-gateway gateways update GATEWAY_ID \
  UPDATE_OPTIONS --api=API_ID --location=GCP_REGION --project=PROJECT_ID  

For example, to update the API config deployed to the gateway:

gcloud api-gateway gateways update GATEWAY_ID \
  --api-config=NEW_CONFIG_ID --api=API_ID --location=GCP_REGION --project=PROJECT_ID 

where NEW_CONFIG_ID specifies the new API config to deploy to the gateway.

Note: There are two important points to keep in mind when updating a gateway with a new API config:

For a complete list of available update flags and arguments, see the gcloud api-gateway gateways update reference or use the following command to view all update options:

gcloud api-gateway gateways update --help
Deleting a gateway

Use the following gcloud command to delete an existing gateway:

gcloud api-gateway gateways delete GATEWAY_ID \
  --location=GCP_REGION --project=PROJECT_ID
What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["Before deploying an API config to an API Gateway, ensure you have configured your development environment, created an API, defined the API, and generated an API config from the definition."],["Gateway IDs must adhere to specific constraints, including a maximum length of 49 characters and the use of only lowercase letters, numbers, or dashes without starting with a dash or containing underscores."],["Deploying an API config to a gateway generates a unique URL for API access in the `gateway.dev` domain, following the format `https://GATEWAY_ID-HASH.REGION_CODE.gateway.dev`."],["The Google Cloud CLI (`gcloud`) is used to deploy API configs to gateways, requiring specification of the gateway ID, API ID, config ID, and the desired Google Cloud region, and it will create the gateway if it does not exist."],["Existing gateways can be updated to deploy a new API config or to change the display name and labels, and they support zero-downtime updates, although some requests may be handled by the previous API config during the update process."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4