Stay organized with collectionsSave and categorize content based on your preferences.
Region ID
TheREGION_IDis an abbreviated code that Google assigns
based on the region you select when you create your app. The code does not
correspond to a country or province, even though some region IDs may appear
similar to commonly used country and province codes. For apps created after
February 2020,REGION_ID.ris included in
App Engine URLs. For existing apps created before this date, the
region ID is optional in the URL.
This section of the guide shows how to use the gcloud CLI to deploy your
Java web service on App Engine. To learn more about
the Java runtime environment, seeJava Runtime Environment.
Install Google Cloud CLI, which provides thegcloudcommand-line
tool. Ensuregcloudis configured to use the Google Cloud project you want to
deploy to.
Key points
Usegcloud app deployandgcloud app browseto deploy and view your
service.
Deploy your service
In yourmy-java-servicefolder, where your Maven POM or
Gradle build file is located, run the following command in your terminal:
gcloudappdeploy
Your source files are then uploaded to Cloud Storage. Cloud Build
builds your app and deploys it to App Engine.
Deploy multiple services
You can add multiple services in your project by creating anapp.yamlfile for each service. Include theserviceattribute in eachapp.yamlfile to specify the name of the service.
To learn more about structuring your app using multiple services, seeStructuring Web Services in App Engine.
Each deployed service will have its own assigned URL.
View your service
To quickly launch your browser and access your web service athttps://PROJECT_ID.REGION_ID.r.appspot.com, use the following
command:
gcloudappbrowse
Services and versions
You've just created and deployed a service on App Engine.
You can specify the name of your service in theapp.yamlfile. If the
name is omitted, it is treated asdefault. The first service you deploy
must be the default service.
You can update your service at any time by running thegcloud app deploycommand again. Each time you deploy, a new version is created and traffic
is automatically routed to the latest version.
To confirm that your service has been created and a version has been deployed:
View your App Engine services in the Google Cloud console:
You should see one timestamped version listed, corresponding to your
deployment.
To learn how to send requests to specific services and versions, seeHow Requests are Routed.
Next steps
Congratulations! You built an application that can store and classify uploaded
images. Learn how to add other features to your application by exploring the
following pages:
See more Java code samples for the App Engine standard environment
on theGoogle Cloud GitHub repository.. These samples can be used for both Java.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-29 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eREGION_ID\u003c/code\u003e is a Google-assigned code based on the region selected during app creation, and it's included in App Engine URLs for apps created after February 2020.\u003c/p\u003e\n"],["\u003cp\u003eThe guide demonstrates how to use the \u003ccode\u003egcloud\u003c/code\u003e CLI to deploy a Java web service to App Engine, with the \u003ccode\u003egcloud app deploy\u003c/code\u003e command being the primary tool for this.\u003c/p\u003e\n"],["\u003cp\u003eMultiple services can be deployed within a single project by creating separate \u003ccode\u003eapp.yaml\u003c/code\u003e files for each service and specifying the \u003ccode\u003eservice\u003c/code\u003e attribute.\u003c/p\u003e\n"],["\u003cp\u003eAfter deploying a service, it can be accessed via a URL that follows the format \u003ccode\u003ehttps://PROJECT_ID.REGION_ID.r.appspot.com\u003c/code\u003e, and the \u003ccode\u003egcloud app browse\u003c/code\u003e command can launch the browser to this address.\u003c/p\u003e\n"],["\u003cp\u003eEach deployment of a service creates a new version, with traffic automatically routed to the latest one, and the first service deployed must be the default service.\u003c/p\u003e\n"]]],[],null,["# Deploy your web service\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\n### Region ID\n\nThe \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e is an abbreviated code that Google assigns\nbased on the region you select when you create your app. The code does not\ncorrespond to a country or province, even though some region IDs may appear\nsimilar to commonly used country and province codes. For apps created after\nFebruary 2020, \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e`.r` is included in\nApp Engine URLs. For existing apps created before this date, the\nregion ID is optional in the URL.\n\nLearn more\n[about region IDs](/appengine/docs/standard/python/how-requests-are-routed#region-id). \nOK\n\n\u003cbr /\u003e\n\n| **Note:** If you are deploying a new Java web service to Google Cloud, we recommend getting started with [Cloud Run](/run/docs/quickstarts/build-and-deploy/deploy-java-service).\n\nThis section of the guide shows how to use the gcloud CLI to deploy your\nJava web service on App Engine. To learn more about\nthe Java runtime environment, see\n[Java Runtime Environment](/appengine/docs/standard/java-gen2/runtime).\n\nBefore you begin\n----------------\n\n1. [Create a Google Cloud project with an App Engine app](/appengine/docs/standard/java-gen2/building-app/creating-project).\n2. [Write a Java web server ready to deploy on App Engine](/appengine/docs/standard/java-gen2/building-app/writing-web-service).\n3. [Install Google Cloud CLI](/sdk/docs/install), which provides the `gcloud` command-line tool. Ensure `gcloud` is configured to use the Google Cloud project you want to deploy to.\n\nKey points\n----------\n\n- Use `gcloud app deploy` and `gcloud app browse` to deploy and view your service.\n\nDeploy your service\n-------------------\n\nIn your `my-java-service` folder, where your Maven POM or\nGradle build file is located, run the following command in your terminal: \n\n gcloud app deploy\n\nYour source files are then uploaded to Cloud Storage. Cloud Build\nbuilds your app and deploys it to App Engine.\n| **Note:** Files listed in your [`.gcloudignore`](/sdk/gcloud/reference/topic/gcloudignore) file will not be uploaded.\n\n### Deploy multiple services\n\nYou can add multiple services in your project by creating an `app.yaml` file for each service. Include the\n`service` attribute in each `app.yaml` file to specify the name of the service.\nTo learn more about structuring your app using multiple services, see\n[Structuring Web Services in App Engine](/appengine/docs/standard/configuration-files#directory_structure).\n\nTo deploy multiple services, follow [these instructions](/appengine/docs/standard/testing-and-deploying-your-app#deploying_multiple_services)\n\nEach deployed service will have its own assigned URL.\n\nView your service\n-----------------\n\nTo quickly launch your browser and access your web service at\n\n`https://`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.`\u003cvar translate=\"no\"\u003e\u003ca href=\"#appengine-urls\" style=\"border-bottom: 1px dotted #999\" class=\"devsite-dialog-button\" data-modal-dialog-id=\"regional_url\" track-type=\"progressiveHelp\" track-name=\"modalHelp\" track-metadata-goal=\"regionalURL\"\u003eREGION_ID\u003c/a\u003e\u003c/var\u003e`.r.appspot.com`, use the following\ncommand: \n\n gcloud app browse\n\nServices and versions\n---------------------\n\nYou've just created and deployed a service on App Engine.\nYou can specify the name of your service in the `app.yaml` file. If the\nname is omitted, it is treated as `default`. The first service you deploy\nmust be the default service.\n\nYou can update your service at any time by running the `gcloud app deploy`\ncommand again. Each time you deploy, a new version is created and traffic\nis automatically routed to the latest version.\n\nTo confirm that your service has been created and a version has been deployed:\n\n1. View your App Engine services in the Google Cloud console:\n\n [View services](https://console.cloud.google.com/appengine/services)\n\n You should see one service listed, named `default`. The default service is\n publicly accessible at the following URL:\n\n\n `https://`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.`\u003cvar translate=\"no\"\u003e\u003ca href=\"#appengine-urls\" style=\"border-bottom: 1px dotted #999\" class=\"devsite-dialog-button\" data-modal-dialog-id=\"regional_url\" track-type=\"progressiveHelp\" track-name=\"modalHelp\" track-metadata-goal=\"regionalURL\"\u003eREGION_ID\u003c/a\u003e\u003c/var\u003e`.r.appspot.com`\n2. View your versions:\n\n [View versions](https://console.cloud.google.com/appengine/versions)\n\n You should see one timestamped version listed, corresponding to your\n deployment.\n\nTo learn how to send requests to specific services and versions, see\n[How Requests are Routed](/appengine/docs/standard/how-requests-are-routed).\n\nNext steps\n----------\n\nCongratulations! You built an application that can store and classify uploaded\nimages. Learn how to add other features to your application by exploring the\nfollowing pages:\n\n- See more Java code samples for the App Engine standard environment on the [Google Cloud GitHub repository.](https://github.com/GoogleCloudPlatform/java-docs-samples/). These samples can be used for both Java.\n- Learn more about writing application logs and interpreting system logs in [Reading and writing application logs](/appengine/docs/standard/writing-application-logs).\n- For a deeper dive into how App Engine works, see the [Java runtime environment](/appengine/docs/standard/java-gen2/runtime)."]]