An App Engine app is configured using an
file, that contains CPU, memory, network and disk resources, scaling, and other
general settings including environment variables.
You can select the new Java 11 or 17 runtime
or use the older the Eclipse Jetty 9.3
or the Java 8 runtime.
For the Eclipse Jetty 9.3 and the Java 8 runtimes, you can use
You can specify the runtime configuration for your Java app,
including versions and URLs, in the
app.yamlfile. 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.
app.yaml demonstrates how to configure your app for
Java version 8, 11 and 17. Note
that you must update your
app.yaml file to use the new version. See
Java runtime for more information
about using the new versions.
runtime: java env: flex runtime_config: operating_system: ubuntu22 runtime_version: 17 handlers: - url: /.* script: this field is required, but ignored manual_scaling: instances: 1
runtime: java env: flex runtime_config: operating_system: ubuntu18 runtime_version: 11 handlers: - url: /.* script: this field is required, but ignored manual_scaling: instances: 1
runtime: java env: flex handlers: - url: /.* script: this field is required, but ignored
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 Java app might require in the
You can specify a unique name for your
app.yaml files, but then you must
specify the file name with the deployment
as well. For example, if you name your
app.flexible.yaml, then you must deploy your app using either:
To learn more about structuring multiple services and
gcloud app deploy service-name-app.yaml gcloud app deploy app.flexible.yaml
app.yamlfiles in your app, see Structuring web services.
All configuration elements
For a complete list of all the supported elements in this configuration file,
Enabling Java Virtual Machine metrics collection
You can configure App Engine flexible environment for Java to collect common metrics for Java Virtual Machine (JVM) processes. The metrics are collected using the same JVM monitoring plugin that Cloud Monitoring uses. To view the full list of metrics for App Engine, see the Google Cloud metrics guide.
If you want to collect these JVM metrics for your app:
you'll need to set the following
properties in the environment variables in your
app.yaml and deploy your app.
JAVA_USER_OPTS: "-Djava.rmi.server.hostname=172.17.0.1 -Dcom.sun.management.jmxremote.port=10403 - Dcom.sun.management.jmxremote.rmi.port=10403 -Dcom.sun.management.jmxremote.local.only=false - Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"