REGION_ID is 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. Including
REGION_ID.r in App Engine URLs is optional for
existing apps and will soon be required for all new apps.
To ensure a smooth transition, we are slowly updating App Engine to use region IDs. If we haven't updated your Google Cloud project yet, you won't see a region ID for your app. Since the ID is optional for existing apps, you don't need to update URLs or make other changes once the region ID is available for your existing apps.
Learn more about region IDs.
Learn how to run your application locally, deploy it, and test on App Engine.
To test your application's functionality before deploying, run your application in your local environment with the development tools that you usually use.For details, including specific commands depending on your plugin, see Local testing for the Java 8/Jetty 9 runtime or Local testing for the Java 8 runtime.
Deploying your application
Before you begin
Before you can deploy your application:
Ensure that your user account includes the required privileges.
Deploying a service
You can use any of the supported tools to deploy your Java application to the
App Engine flexible environment. For command-line deployment, use
gcloud app deploy from the Cloud SDK, or
use the Maven or the Gradle plugins. To deploy using an IDE,
use the IntelliJ or Eclipse plugins. To programmatically deploy your apps,
use the Admin API.
You can use a
file to specify files and directories not to upload to Google Cloud
when you deploy your services. This is useful for ignoring build artifacts
and other files that do not need to be uploaded with your deployment.
Learn more about the syntax of the
.gcloudignore file in the
Manually building a container for deployment
To build your container images outside of Google Cloud Platform, you must
first upload your images to a container image repository before you can deploy
your images to App Engine with the
gcloud app deploy command.
For example, if you build your container images locally with Docker, you can
push those images to Google Container
Registry and then
specify the URL of your image in the
--image-url flag of the command:
gcloud app deploy src/main/appengine/app.yaml --image-url gcr.io/YOUR_PROJECT_ID/YOUR_CONTAINER_IMAGE
Using automated continuous deployment pipelines
You can use Cloud Build to automate deployments in continuous deployment pipelines. For more information, see Deploying artifacts, and Automating Builds using Build Triggers in the Cloud Build documentation.
Docker base images for Java
If you'd like to build a Java custom runtime application from scratch, use a provided base image in your Dockerfile:
|Java 8 / Jetty 9||
Viewing your application
After you deploy your application to App Engine, you can run the
following command to launch your browser and view it at
gcloud app browse
Testing on App Engine
Before configuring a new version to receive traffic, you can test it on
App Engine. For example, to test a new version of your
Deploy your new version with the
promoteparameter set to
- With Maven, set the
promoteparameter in your
- With Gradle, set the
promoteparameter in your
- With Maven, set the
Access your new version by navigating to the following URL:
Now you can test your new version in the App Engine runtime environment. You can debug your application by viewing its logs in the Google Cloud Console Logs Viewer. For more information, see Writing Application Logs.
Requests sent to
https://PROJECT_ID.REGION_ID.r.appspot.comwill still be routed to the version previously configured to receive traffic.
When you want to send traffic to the new version, use the Cloud Console to migrate traffic:
Select the version you just deployed and click Migrate traffic.
You can use the same process to test new versions of other services
default in the URL with your service's name:
The following are common error messages that you might encounter when deploying apps:
PERMISSION_DENIED: Operation not allowed
The "appengine.applications.create" permission is required.
- If the Cloud project does not include the required
gcloud app deploycommand can fail when it tries to run the
gcloud app createcommand. Only accounts with Owner role have the necessary permissions to create App Engine applications.
502 Bad Gateway
- The Cloud project can fail to start if the
app.yamlis misconfigured. Check the app logs for more detailed error messages.