Get in touch with Google Cloud App Engine
- Vishakh Rameshan
- Jan 1, 2021
- 4 min read
Updated: Jan 30, 2021

App Engine is a PAAS (Platfomr-as-a-service) offered by Google Cloud to deploy monolithic or microservices in jar or war format. This post is not to discuss the advantages or disadvantages instead this post will clarify some of the queries that each person have when interacting for the first time. App Engine has lots of features and some unclear areas that most of the blogs forget to mention. As I have used App Engine and I have already went through all the unclear areas, let me help you get a picture on the entire App Engine Platform.
This post is not a replacement to any other blog nor it can be very apt with that of Google official documentation which covers topics in depth, but instead this post will clarify most of the doubts that a newbie will have, by creating application, deploying to the platform and intern pointing to some key concepts and terms.
Standard vs Flexible
When you interact App Engine platform to deploy an application, you will be asked to choose between 2 flavors - Standard and Flexible. You can decide the best only if you have a clear understanding on both and your requirement.
Google Document provides a detailed difference between these which you can refer from this link. But in my opinion, difference comes with your need and those can be categorized as below
Monolithic vs Microservices
If your application is a war (mvc pattern, having UI, Service layer and Database layer) go for Standard. If you have micro services (such as spring boot jars) go for Flexible
Expected Traffic
If your application is expecting a fluctuation in traffic, both platforms support serving high/low traffic. But the major difference is that Standard goes to 0 instance when there are no traffic, whereas Flexible goes to 1 instance.
Modifying Runtime
If you want to modify the runtime like java, python with specific versions, it is supported only in flexible environment through use of a Dockerfile.
Overview of App Engine Platform

Detailed explanation you can refer official Google Cloud Documentation here. But here, I would like to simplify my mapping to an enterprise application.
Say you have an e-commerce application such as Amazon/Flipkart and you segregate features like, product category, Product listing, product details, user login, Order, Purchase, Payment etc as micro services.
Application - here e-commerce application is the top level entity to be deployed in App Engine.
Service - Each of the features which will be independent microservice will be the service entity the second level.
Version - each microservice will be deployed with different versions (having additional features deployed), like order-service-v1.0.0, order-service-v1.0.1
Instance - is the container on which it runs
Another example, say you have 2 different application one a monolithic e-commerce application and another monolithic travel booking.
Application - either one of the application which is deployed first in the App Engine will be the default application
Service - Each monolithic application will be one service
Version - Each monolithic independent of each other can be revisioned with new features
Instance - node/vm on which it runs
The advantage that service brings here is that you can independently configure the service, create multiple revisions, have canary deployment, traffic splitting etc.
Each service and its version has an unique URL https://VERSION_ID-dot-SERVICE_ID-dot-PROJECT_ID.REGION_ID.r.appspot.com
But there are some limits on the number of services and version you can deploy to App Engine on a single GCP project

Set up Cloud Tools for Eclipse and also install Cloud SDK
Google has provided a developer friendly way to create, test and deploy app engine applications on to the platform. To achieve this there are some pre requisites and those are
SetUp Cloud SDK on Local machine - Refer this to install cloud sdk on your local machine
Install App Engine component on Cloud SDK
When cloud sdk is installed on local machine, there are some components pre installed like gcloud, gsutil etc, both for our specific app engine use case, we need to install the app engine for java component explicitly.


Setup Cloud Tools for Eclipse (its my choice of IDE)
Cloud Tools are plugins used to create skeleton app engine application, map to a project, test it in local and deploy to cloud

Configure Cloud Tools to use Cloud SDK by pointing Cloud SDK to the installation directory

Once done, you will be able to create App Engine Standard and Flexible projects, just like we used to create maven projects.

Deploying Application To Standard Environment
Create App Engine standard Project - a simple hello world war application
Note: the application created will have a important file ie, the appengine-web.xml. If you already have a monlethic application but to make it App Engine Standard compatible, you need to create this file under src/main/webapp/WEB-INF/appengine-web.xml

Testing in local - you do not need a tomcat or jetty server, instead the war will be deployed in the app engine local server


Deploy to App Engine Standard - Once tested in local and everything is working as expected, you can deploy the application from eclipse or from cloud sdk to the respective project

Once deployed, you can view on the App Engine page as a service.




Github Code - https://github.com/Hitman007IN/Google-App-Engine-Feature-Testing/tree/master/demoAppEngineStandard
Deploying Application To Flexible Environment
By default App Engine Flexible APIs are not enabled, so need to explicitly enable it.

Create App Engine Flexible project in local IDE
By Default App Engine is meant to support or deploy JAR, but if you have a war then you have to explicitly mention the facets


View configuration of the application deployed to the platform. You can see the env as flexible


GitHub Code - https://github.com/Hitman007IN/Google-App-Engine-Feature-Testing/tree/master/demoAppEngineFlexible
Different Use Cases
To Convert an existing war to App Engine Compatible one - You will have an option in the IDE which Cloud Tools provider to convert it

Pre-requisite
You need to package project as WAR instead of JAR
Add src/main/webapp/WEB-INF/appengine-web.xml

GitHub Code - https://github.com/Hitman007IN/Google-App-Engine-Feature-Testing/tree/master/SampleWebApplication
To Convert a jar to App Engine Flexible compatible - add app.yml under src/main/appengine

GitHub Code - https://github.com/Hitman007IN/Google-App-Engine-Feature-Testing/tree/master/SpringBootHelloWorld
Limitations
There is no option to delete a default application/version already deployed to App Engine. But we can disable either entire App Engine belonging to that project or stop/delete the serving instance versions.

There is no option to change the zone or region once deployed. It's permanent.
There can only be one App Engine for a GCP project, if due to some reason you want to delete and recreate App Engine, it's only possible by deleting the GCP project.
You can deploy only one application to App Engine of a project. If you have multiple applications, it can be deployed as services and versions

Comments