Defining runtime settings

An App Engine app is configured using anapp.yamlfile, that contains the runtime, handlers, scaling, and other general settingsincluding environment variables.

Aboutapp.yaml files

You can specify the runtime configuration for your Java app,including versions and URLs, in theapp.yaml file. This file acts as a deployment descriptor of a specificserviceversion.

If you don't create anapp.yaml file, thegcloud app deploy command cancreate one when you deploy yourapplication.Theapp.yaml file that App Engine creates contains only the settingsthat are required to run your application.

Generally, yourapp.yaml file requires only theruntime element for a simpleJava app in the standard environment, forexample:

runtime:java25

App Engine provides default values for all other settings, includingtheF1 instance class, whichdetermines the memory and CPU resources that are available to your app, andautomatic scaling,which controls how and when new instances of your app are created.

If you need to override the default settings, create anapp.yaml file andspecify the settings you need. For more information, seeapp.yaml file reference.

You can specify a unique name for yourapp.yaml files, but then you mustspecify the file name with thedeploymentcommandas well. For example, if you name yourapp.yaml fileservice-name-app.yamlorapp.standard.yaml, then you must deploy your app using either:

gcloud app deploy service-name-app.yamlgcloud app deploy app.standard.yaml
To learn more about structuring multiple services andapp.yaml files in yourapp, seeStructuring web services.

For a Maven project, the standard location forapp.yaml file is under thesrc/main/appengine directory. The App Engine Maven plugin willcreate a correcttarget/appengine-staging directory containing your JARartifacts and thisapp.yaml file, ready for deployment.

The following is a sample Maven project structure:

MyDir/  pom.xml  [index.yaml]  [cron.yaml]  [dispatch.yaml]  src/main/    appengine/      app.yaml    java/com.example.mycode/      MyCode.java

If you have more than one JAR file in your project directory or want tospecify a custom entrypoint, you must specify it in theentrypoint element ofyourapp.yaml file.

All configuration elements

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

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

Last updated 2025-12-15 UTC.