Google Cloud Platform (GCP) App Engine Dispatch Configuration

Eric Pedersen
2 min readJun 21, 2021

Google Cloud Platform (GCP) App Engine is a great service that eases the process of developing web applications. Google App Engine deploys and scales the containers and its up to you to pick your programming language and deploy your software.

When you create more advanced App Engine deployments you will eventually need to configure a dispatch.yaml file to handle how traffic is split between your devices.

Sample application dispatch structure

For this exercise we will configure three Python applications that handle three different features of a sample application. For this example, we will split our API, admin, and main web applications into separate services.

By doing this we enable the development team to make changes to a single piece of the code and not require a release of the entire application each time.

Configure services

Each service will need to be configured and deployed to Google App Engine. You would need to configure each service with its own app.yaml file and deploy each.

service: test-api
secure: always
handlers:
- url: /.*
script: auto

The above code snippet is an example of the app.yaml file for the API service. The service section describes the name of the service and will be needed to configure how dispatch will work.

Configure dispatch.yaml

dispatch:
- url: "*/api/*"
service: test-api

- url: "*/web/*"
service: test-website
- url: "*/admin/*"
service: test-admin

In order to route the traffic correctly you need to specify the URL with wildcard characters and then the name of the service to send the traffic to.

Deploy the dispatch.yaml file

gcloud app deploy dispatch.yaml

The above command sends the dispatch file to GCP App Engine. Once the file is sent the routing should start working.

Thanks for reading my short article!

--

--