It was already quite straightforward to migrate from App Engine to Cloud Run, but I made it even easier by creating a tool that guides you and automates some of the changes:
See an end to end demo of migrating from App Engine to Cloud Run in 10 minutes:
Cloud Run and App Engine both allow you to run your code in an environment fully managed by GCP.
But there are 3 main differences:
- Code vs container: Cloud Run takes any container that is able to listen for HTTP requests, while App Engine supports a set of languages and takes care of building them for you.
- Config files are different: App engine uses a proprietary “app.yaml”, while Cloud Run implements the Knative Serving API, which can be described in a standard “service.yaml”.
- Static files: App Engine supports static file handlers, while Cloud Run only takes care of the running containers.
These 3 differences can be easily addressed:
- Code vs container: To transform the code of an App Engine app into a container, we can simply use Google Cloud’s open source buildpacks, which are exactly what App Engine uses under the hood when you type “gcloud app deploy”. This only applies to second generation runtimes of the App Engine standard environment and to App Engine flexible environments. For first generation runtimes, you’ll need first to migrate to a second generation runtime.
- Config files: The configuration of an App Engine service can be almost entirely translated into the configuration of a Cloud Run service (Knative Service Object).
- Static files: Static files and folders have to be served from the container, or from a Google Cloud Storage bucket.
Check out the App Engine to Cloud Run online migration tool.