Friends of OpenJDK Today

How to Deploy a Vaadin Application to Google Cloud App Engine

July 26, 2022


  • Simon Martinelli

    Programming Software Architect at 72 Services LLC, Vaadin Community Award Winner

I tried to deploy a Vaadin application to Google Cloud App Engine.

It was not as straightforward as expected, so I want to share my findings.

The example project is available on GitHub:

The Vaadin Application

First, I’ve created a new Vaadin application:

Then I did a production build:

mvn package -Pproduction

That will generate an executable JAR file in the target directory.

First Deployment

Google AppEngine provides F2 instance type with enough memory for Spring Boot and Java 17 by default. There is no need to configure anything, and I can simply execute:

gcloud app deploy

This work! But is there even a simpler way?

Maven Plugin

I could use a Maven plugin to deploy the application:


And now I just have to call:

mvn package appengine:deploy -Pproduction

Session State

As you may know, Vaadin applications have server state and may also have push enabled that will use WebSockets.

We must enable session affinity to ensure our application runs correctly in multiple instances.

This can be done in the app.yaml as well

    session_affinity: true

But what does session affinity mean? Let’s check the documentation:


Optional. Set to true to configure App Engine to route multiple sequential requests for a given user to the same App Engine instance such as when storing user data locally during a session.

Session affinity enables inspecting the value of a cookie to identify multiple requests by the same user and then directs all such requests to the same instance. If the instance is rebooted, unhealthy, overloaded or becomes unavailable when the number of instances has been scaled down, session affinity will be broken and further requests are then routed to a different instance.

Note that enabling session affinity can affect your load balancing setup. This parameter is disabled by default.


Deploying to Google App Engine is straight-forwarded using the Maven plugin, but you must analyze the log files and probably configure the Java version, the instance size, and session affinity.

Related Articles

View All


  • Simon Martinelli

    Programming Software Architect at 72 Services LLC, Vaadin Community Award Winner

Comments (4)

Your email address will not be published. Required fields are marked *

Highlight your code snippets using [code lang="language name"] shortcode. Just insert your code between opening and closing tag: [code lang="java"] code [/code]. Or specify another language.

Save my name, email, and website in this browser for the next time I comment.


Hi, Thanks for the post.
We will change the Cloud SDK CLI to use the java17 by default, now that it is GA.
For memory usage on F1 instance class, we are investigating some options…
Thanks for the nice blog!

Simon Martinelli

Thank you for the information. I’m happy you liked it.


Hi Simon, If you retry with the last Cloud SDK release, you will see that you we now default to
java17 and
F2 instance class,
so this blog can be updated by removing all the unnecessary steps, simplifying a lot this getting started work when targeting App Engine Java 17 Standard!


Simon Martinelli

Hi Ludo,
Great news!
I’ll update the post as soon as possible.

Thank you

Subscribe to foojay updates:
Copied to the clipboard