The case
The pickup site has to be live by Friday. Nobody on the team wants to manage a server.
Isaac's store has decided to sell through its site, with pickup at the store. The system is being built by an intern, with help from a developer friend, and the deadline is two weeks. Nobody wants to learn how to set up a machine, a load balancer or a certificate for this. The team only wants to upload the code and start receiving orders.
This post builds on Serverless and Cloud Run on Google Cloud, which presents the serverless models, and on Compute Engine, where the machine is yours to manage. App Engine sits in the middle: you deliver the code, and the platform takes care of the rest.
The problem
Uploading the code should not mean a list of chores
On Compute Engine, the store chooses the operating system image, installs the language runtime, sets up the load balancing, the certificates and the firewall rules, and has to take care of restarting a machine that goes down. It is total control, but it is also a long list. For a simple site, almost all of that is work that sells nothing.
The solution
App Engine: you deploy, the platform takes care of the rest
App Engine is a platform as a service (PaaS) on Google Cloud. You send the application, and it takes care of load balancing, of scaling instances up and down with traffic, of previous versions and of checking whether instances are healthy.
| Question | Compute Engine (IaaS) | App Engine (PaaS) |
|---|---|---|
| Who chooses and maintains the operating system | You | The platform |
| Who sets up load balancing | You | The platform |
| Who handles a new version without taking down the old one | You | The platform, with traffic splitting |
| How much control you have over the machine | Total | Less, limited to what the platform offers |
Environments
Two environments, two ways to run
App Engine has two environments. The choice depends on two questions: does the application need to scale to zero? And does it need an environment you control?
Standard
“Does it need to scale to zero and start up in seconds?”
- Example
- The store's order site: almost no traffic at night, and a peak on Friday evening.
- Focus
- Each language runs in its own sandbox, among the supported languages. It scales down to zero instances, and billing follows instance hours.
Flexible
“Does it need an environment you control, or SSH?”
- Example
- A restocking panel that depends on a system library and runs a background process.
- Focus
- Each instance is a container on a Compute Engine VM, with SSH access and background processes. It keeps at least one instance running, so it never reaches zero.
Hierarchy
Application, service and version
App Engine organizes what you publish into four levels. Each Google Cloud project has one application. Inside it are the services, which are components with their own settings. Each service has versions, and each version runs on one or more instances.
| Level (level) | What it is | Example at the store |
|---|---|---|
| Application (application) | One per project | The whole store |
| Service (service) | A component, with its own settings | The order site and the restocking panel |
| Version (version) | Code and configuration, which can coexist with other versions | The new version of the order site |
| Instance (instance) | A running copy of the version, which serves the requests | Two instances of the new version |
Since several versions can be active at the same time, traffic can be split between them. For example, 90% to the current version and 10% to the new one. If the new one causes problems, traffic goes back to the previous one, without redeploying anything.
Don't mix them up
App Engine × Cloud Run
App Engine
“Do you want to publish the code without thinking about containers?”
- Example
- The store's site, uploaded as Python code, with versions and traffic splitting.
- Focus
- The platform prepares the language environment. Application, services, versions and traffic splitting come ready.
Cloud Run
“Do you already have a container that answers HTTP requests?”
- Example
- The same site, packaged with the operating system and libraries you chose.
- Focus
- Runs any HTTP container, without depending on App Engine runtimes. It also scales to zero.
In practice
Which environment for each part of the store
| System part | Choice | Why |
|---|---|---|
| Order site, with a Friday-evening peak | App Engine Standard | Scales to zero and starts in seconds |
| Restocking panel with a system library | App Engine Flexible | Runs on a VM and accepts SSH for debugging |
| Label service, already packaged in a container | Cloud Run | Runs the container that already exists |
Key terms
Five terms to remember
Tap a card to see the definition.
Quick test
Three questions, exam style
01
The store wants an order site that costs nothing at night and scales up fast at the Friday peak. Which App Engine environment should it use?
02
The team needs to log in by SSH to the application's machine to investigate a failure. Which environment allows this?
03
Isaac created the order application in the São Paulo region and now wants to change its region. What is true?
At the store, App Engine runs the order site without anyone managing a machine. The next step in the track is Containers in the Cloud, for when the container itself is what you package.