Skip to content

Chapter 8 of 11

Serverless: Cloud Run Functions and App Engine

Build managed event-driven functions and applications with safe scaling and delivery.

46 minutes 10 quick checksBy Subha Prasad
Lesson 8 of 11Course navigation

Lesson content

Read, practise, then check your understanding

Serverless: Cloud Run Functions and App Engine

Cloud Run functions runs event-driven code and is the current evolution of Cloud Functions. Cloud Run services run stateless containers behind managed HTTPS endpoints. App Engine remains a managed application platform with standard and flexible environments.

Core ideas

  • Cloud Run functions can respond to HTTP or events and is integrated with the Cloud Run execution model.
  • Eventarc routes supported cloud events to destinations such as functions and Cloud Run services.
  • App Engine standard emphasizes sandboxed managed runtimes; flexible uses containers on managed Compute Engine infrastructure.
  • Serverless scaling can reach downstream limits unless maximum instances and concurrency are controlled.

Design and operating model

Choose functions for small event handlers, Cloud Run services for containerized HTTP applications, and App Engine when its platform model fits an existing application. Keep handlers idempotent, use service accounts, validate events, configure retries and dead-letter paths, and trace execution across services.

Example

import functions_framework

@functions_framework.http
def hello(request):
    payload = request.get_json(silent=True) or {}
    name = payload.get("name", "learner")
    return {"message": f"Hello, {name}"}, 200

Run examples in a disposable training project. Replace project IDs, Regions, identities, resource names, sizes, and policies with reviewed values, and verify current Google Cloud CLI and service requirements before production use.

Production guidance

  • Do not place credentials in environment variables when Secret Manager references or identity can be used.
  • Set CPU, memory, timeout, concurrency, min/max instances, ingress, and authentication deliberately.
  • Load-test cold-start and burst behavior and make downstream calls bounded, retried, and observable.

The chapter quiz follows the lesson and checks both service vocabulary and architecture decisions.

Knowledge check

Answer every question correctly to complete this chapter.

Which statement correctly describes Cloud Run functions?
Which term matches this explanation: Event-driven functions deployed on Google Cloud's serverless infrastructure.
Which statement correctly describes Cloud Run service?
Which term matches this explanation: A managed autoscaling HTTPS service for containerized code.
Which statement correctly describes App Engine?
Which term matches this explanation: A managed application platform with standard and flexible environments.
Which statement correctly describes Eventarc?
Which term matches this explanation: A service routing events from Google Cloud sources to destinations such as Cloud Run.
Which statement correctly describes cold start?
Which term matches this explanation: Initialization latency when the platform creates a new serverless instance.

0 of 10 checks passed

Your progress is saved on this device.

Serverless: Cloud Run Functions and App Engine | GCP Lesson | Subha Prasad