Documentation versions (currently viewingVaadin 23)

Deploying a Vaadin Application to Google Cloud

This tutorial shows you how to deploy a Vaadin application to Google App Engine. Google Cloud has free-trial and free-tier offerings that you can read more about on the Google Cloud website.

Google Cloud account required
To complete this tutorial, you need to sign up for a Google Cloud account at Your Google Cloud account should also have the billing enabled.

Step 1: Install and Set Up Google Cloud SDK

To begin, download and install the Google Cloud SDK.

After it is installed, run the following command from a terminal window to add App Engine support for Java to the SDK.

gcloud components install app-engine-java

Step 2: Download a Starter App

Download a minimal Vaadin project and unpack the downloaded zip into a folder on your computer.

Due to issue 14164, you will need to disable the @PWA annotation found on the Application class.

Step 3: Initialize a Google Cloud Project

Open the project directory from a terminal window, and enter the following command to initialize a Google Cloud project:

gcloud init

If this is your first time running Google SDK, you will be asked to authenticate your account. When prompted to log in, enter 'Y' and allow the SDK to control your account in the opened browser window.

After authentication, you will prompted to select a configuration. Enter '1' to select the default configuration, as in the following snippet:

Settings from your current configuration [default] are:
  screen_reader: 'False'
  disable_usage_reporting: 'True'

Pick configuration to use:
 [1] Re-initialize this configuration [default] with new settings
 [2] Create a new configuration
Please enter your numeric choice:  1

Step 4: Create an App Engine Instance

From a terminal window, in the project root directory, create a Google App Engine instance using the following command:

gcloud app create

You will then be asked to select a region. You may want to choose the region that is geographically closest to your users.

Step 5: Set Up the App Engine Plugin for Maven

Add the App Engine Maven plugin to your project’s pom.xml file.


Note that projectId and version must be set for the plugin to work. The value GCLOUD_CONFIG tells the Google Cloud CLI tools to use the projectId configured in step 4. Also, make sure to use the latest version of the appengine-maven-plugin, which you can find at this link.

Step 6: Create the app.yaml File

Next, you need to create an app.yaml file.

  1. Create a directory called appengine under src/main.

  2. Create a file called app.yaml under src/main/appengine. This file should have the following content.

    runtime: java11

    You should change the java runtime version number (java11) in the yaml file to match the value of the <java.version> property in your pom.xml file.

Step 7: Enable Cloud Build

You will also need to enable Cloud Build.

  1. Navigate to, replacing PROJECT_NAME with your project name found at Google Cloud Resource Manager.

  2. Click Enable.

Step 8: Deploy to Google App Engine

Finally, you can build and deploy using a single command as follows:

mvn package appengine:deploy -Pproduction

When the deployment has finished, the application URL will be displayed in the logs.

Common Problems

Ensure Google Cloud Billing is Enabled

If the deployment fails with an error similar to ERROR: ( Error Response: [7] Access Not Configured., then ensure that your Google Cloud account has billing enabled. After it is enabled, try to deploy again.

Memory Limit

If you notice log messages similar to Exceeded soft memory limit of 256 MB with X MB, this means your instance has ran out of RAM. You should consider upgrading to a larger App Engine instance that fits your needs.

Be mindful of costs when upgrading. Larger instances will most likely incur more fees.