Configuring your app with app.yaml

An App Engine app is configured using an app.yaml file, that contains CPU, memory, network and disk resources, scaling, and other general settings including environment variables.

About app.yaml files

You can specify the runtime configuration for your .NET app, including versions and URLs, in the app.yaml file. This file acts as a deployment descriptor of a specific service version.

You must first create the app.yaml file for the default service of your app before you can create and deploy app.yaml files for additional services.

The following app.yaml demonstrates how to configure your app for .NET version 3.1 and earlier, and version 6 and later. Note that you must update your app.yaml file to use the new version. See .NET runtime for more information about using the new runtimes.

version 6 and later

runtime: aspnetcore
env: flex

runtime_config:
  operating_system: ubuntu22

# This sample incurs costs to run on the App Engine flexible environment. 
# The settings below are to reduce costs during testing and are not appropriate
# for production use. For more information, see:
# https://cloud.google.com/appengine/docs/flexible/dotnet/configuring-your-app-with-app-yaml
manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10

env_variables:
  # The __ in My__Greeting will be translated to a : by ASP.NET.
  My__Greeting: Hello AppEngine!

version 3.1 and earlier

runtime: aspnetcore
env: flex

# This sample incurs costs to run on the App Engine flexible environment. 
# The settings below are to reduce costs during testing and are not appropriate
# for production use. For more information, see:
# https://cloud.google.com/appengine/docs/flexible/dotnet/configuring-your-app-with-app-yaml
manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10

env_variables:
  # The __ in My__Greeting will be translated to a : by ASP.NET.
  My__Greeting: Hello AppEngine!
Depending on the complexity of your app's service, you might only need to define a few elements in the corresponding app.yaml file. The following example demonstrates what a simple .NET app might require in the flexible environment:

You can specify a unique name for your app.yaml files, but then you must specify the file name with the deployment command as well. For example, if you name your app.yaml file service-name-app.yaml or app.flexible.yaml, then you must deploy your app using either:

gcloud app deploy service-name-app.yaml
gcloud app deploy app.flexible.yaml
To learn more about structuring multiple services and app.yaml files in your app, see Structuring web services.

All configuration elements

For a complete list of all the supported elements in this configuration file, see the app.yaml reference.