App Engine 앱은 CPU, 메모리, 네트워크 및 디스크 리소스, 확장, 환경 변수를 비롯한 기타 일반 설정이 포함된 app.yaml 파일을 사용하여 구성됩니다.
app.yaml 파일 정보
버전과 URL이 포함된 자바 앱의 런타임 구성을 app.yaml 파일에 지정할 수 있습니다. 이 파일은 특정 서비스 버전의 배포 설명자 역할을 합니다.
추가 서비스를 위해 app.yaml 파일을 만들고 배포하려면 먼저 default 서비스의 app.yaml 파일을 만들어야 합니다.
다음 app.yaml 샘플에서는 최신 Java 버전에 맞게 앱을 구성하는 방법을 보여줍니다.
지원되는 Java 런타임 사용 방법에 대한 자세한 내용은 Java 런타임을 참조하세요.
runtime:javaenv:flexruntime_config:operating_system:"ubuntu22"runtime_version:"21"handlers:-url:/.*script:this field is required, but ignoredmanual_scaling:instances:1
앱 서비스의 복잡성에 따라 해당 app.yaml 파일에 몇 가지 요소만 정의해야 할 수 있습니다. 다음 예에서는 가변형 환경에서 간단한 자바 앱에 필요한 사항을 설명합니다.
app.yaml 파일에 고유한 이름을 지정할 수 있습니다. 하지만 이렇게 하면 배포 명령어에도 파일 이름을 지정해야 합니다. 예를 들어 app.yaml 파일의 이름을 service-name-app.yaml이나 app.flexible.yaml로 지정한 후 다음 중 하나를 사용하여 앱을 배포해야 합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eThe \u003ccode\u003eapp.yaml\u003c/code\u003e file is essential for configuring an App Engine app, defining settings like CPU, memory, network, disk resources, scaling, and environment variables.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eapp.yaml\u003c/code\u003e acts as a deployment descriptor for a specific service version, and the default service must have an \u003ccode\u003eapp.yaml\u003c/code\u003e file created first.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eapp.yaml\u003c/code\u003e file allows for specifying the Java runtime configuration, including versions and URLs, and an example configuration is provided for the latest Java version.\u003c/p\u003e\n"],["\u003cp\u003eYou can customize the \u003ccode\u003eapp.yaml\u003c/code\u003e filename, but if you do, you must use the custom name when deploying your app with the \u003ccode\u003egcloud\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eYou can configure your Java App Engine flexible environment to collect JVM metrics, such as garbage collection count and time, by setting JMX system properties in the \u003ccode\u003eapp.yaml\u003c/code\u003e environment variables.\u003c/p\u003e\n"]]],[],null,["# Configuring your app with app.yaml\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\n| **Note:** Some [Java runtimes](/appengine/docs/flexible/lifecycle/support-schedule#java) have reached [end of support](/appengine/docs/flexible/lifecycle/runtime-lifecycle#end_of_support). You cannot re-deploy versions that use runtimes after their end of support date. We recommend that you [upgrade your app](/appengine/docs/flexible/java/runtime#newversions) to use the latest version of Java.\n\n\u003cbr /\u003e\n\n\nAn App Engine app is configured using an `app.yaml`\nfile, that contains CPU, memory, network and disk resources, scaling, and other\ngeneral settings including environment variables.\n\n\nAbout `app.yaml` files\n----------------------\n\n\u003cbr /\u003e\n\nYou can specify the runtime configuration for your Java app, including versions and URLs, in the `app.yaml` file. This file acts as a deployment descriptor of a specific [service](/appengine/docs/flexible/an-overview-of-app-engine) version.\n\n\u003cbr /\u003e\n\n\nYou must first create the `app.yaml` file for the `default` service of your app\nbefore you can create and deploy `app.yaml` files for additional services.\n\n\nThe following `app.yaml` sample demonstrates how to configure your app for\nthe [latest Java version](/appengine/docs/flexible/lifecycle/support-schedule#java).\nFor more information about using supported Java runtimes, see the\n[Java runtime](/appengine/docs/flexible/java/runtime). \n\n runtime: java\n env: flex\n runtime_config:\n operating_system: \"ubuntu22\"\n runtime_version: \"21\"\n handlers:\n - url: /.*\n script: this field is required, but ignored\n\n manual_scaling:\n instances: 1\n\n\nDepending on the complexity of your app's service, you might only need to define\na few elements in the corresponding `app.yaml` file. The following example\ndemonstrates what a simple Java app might require in the\nflexible environment:\n\n\nYou can specify a unique name for your `app.yaml` files, but then you must\nspecify the file name with the [deployment\ncommand](/appengine/docs/flexible/testing-and-deploying-your-app)\nas well. For example, if you name your `app.yaml` file `service-name-app.yaml`\nor `app.flexible.yaml`, then you must deploy your app using either: \n\n gcloud app deploy service-name-app.yaml\n gcloud app deploy app.flexible.yaml\n\nTo learn more about structuring multiple services and `app.yaml` files in your app, see [Structuring web services](/appengine/docs/flexible/configuration-files).\n\n\u003cbr /\u003e\n\nAll configuration elements\n--------------------------\n\nFor a complete list of all the supported elements in this configuration file,\nsee the\n[`app.yaml` reference](/appengine/docs/flexible/reference/app-yaml).\n\nEnabling Java Virtual Machine metrics collection\n------------------------------------------------\n\nYou can configure App Engine flexible environment for Java to collect common metrics for Java\nVirtual Machine (JVM) processes. The metrics are collected using the same\n[JVM monitoring plugin](/monitoring/agent/plugins/jvm)\nthat [Cloud Monitoring](/monitoring) uses. To view the full list of metrics\nfor App Engine, see the [Google Cloud metrics guide](/monitoring/api/metrics_gcp_a_b#gcp-appengine).\n\nIf you want to collect these JVM metrics for your app:\n\n- `appengine.googleapis.com/flex/instance/jvm/gc/count`\n- `appengine.googleapis.com/flex/instance/jvm/gc/time`\n\nyou'll need to set the following\n[JMX](http://www.oracle.com/technetwork/articles/java/javamanagement-140525.html) system\nproperties in the environment variables in your `app.yaml` and deploy your app. \n\n JAVA_USER_OPTS: \"-Djava.rmi.server.hostname=172.17.0.1 -Dcom.sun.management.jmxremote.port=10403 -\n Dcom.sun.management.jmxremote.rmi.port=10403 -Dcom.sun.management.jmxremote.local.only=false -\n Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false\"\n\n| **Note:** The `172.17.0.1` IP enables your container to connect to the JVM monitoring plugin running in App Engine flexible environment. Port 10403 is the reserved `JMX_PORT` on the app container which the monitoring plugin connects to."]]