Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Update the Config File (YAML) of API Gateway

Does GCP allow you to update YAML of a API Gateway already created?

Use Case : Today, I have 5 API's which are included as part of the YAML file and a Gateway was created from UI by selecting the YAML as Config file.

All the 5 API's work without a problem.

Now, we have a 6th API and I want to add this 6th API to the same gateway. Though I can update the YAML file with 6th API, how can I update the Gateway with the new YAML file? There is no option to "update the configuration":

vbgcp_0-1679392506829.png

I was hoping that the "edit" window allows me to update a new YAML file:

vbgcp_1-1679392649112.png

But, it only allows me to change the display name:

vbgcp_2-1679392675113.png

So, how to find a solution to my use case as I explained above?

Solved Solved
0 5 3,382
1 ACCEPTED SOLUTION

OK, Looks like GCP Cloud Web Console does not have have the capability, its a pity.

Nevertheless, I was able work on the use case using the CLI. What I was able to do was, add a new configuration to the API Gateway and after that, using the CLI command, "update the gateway" to use the new config.

The below are the two configs for the gateway. First one was the old one and 2nd one was added.

vbgcp_0-1679663368875.png

Below command is switching the config key from first one to second one.

gcloud api-gateway gateways update my-gateway --api=my-api --api-config=my-config-key --location=us-east1 --project=XXXXX-XXXXX-356803

This way, we can keep updating the config whenever any new Cloud Functions get added to the system.

View solution in original post

5 REPLIES 5

Hi @vbgcp,

Welcome to Google Cloud Community!

As of the moment, we can only update the display name and labels for API gateway as stated in this API gateway reference:

NOTE: Only the name and labels may be updated on an API config.

You need to create a new API config if there are changes/modifications to your API. You can check this documentation on how to create a new API config.

You may also want to file this one as a feature request. We don't have a specific ETA for this however you can keep track of its progress once the ticket has been created.

Thanks @robertcarlos , interesting.

You cannot even do incremental configurations. I mean to say, an API will have two configurations.

For Example, 1st config having 5 API (Cloud Function) Calls and 2nd Config having new 1 API (Cloud Function) call as the 2nd configuration will create a "new gateway" URL.

New Gateway URL (due to new API Config) will defeat the purpose of having a single Gateway for all Cloud Functions we have.

I am not sure how is everyone managing this situation as this is a regular occuring scenario where companies make enhancements to their offerings and their product by adding more cloud functions.

Can you suggest how this type if situation is managed to avoid multiple gateway URL's?

OK, Looks like GCP Cloud Web Console does not have have the capability, its a pity.

Nevertheless, I was able work on the use case using the CLI. What I was able to do was, add a new configuration to the API Gateway and after that, using the CLI command, "update the gateway" to use the new config.

The below are the two configs for the gateway. First one was the old one and 2nd one was added.

vbgcp_0-1679663368875.png

Below command is switching the config key from first one to second one.

gcloud api-gateway gateways update my-gateway --api=my-api --api-config=my-config-key --location=us-east1 --project=XXXXX-XXXXX-356803

This way, we can keep updating the config whenever any new Cloud Functions get added to the system.

HI @vbgcp how did you add a new configuration, without creating a new gateway?

How You do it?