Python 2.7 has reached end of supportand will bedeprecatedon January 31, 2026. After deprecation, you won't be able to deploy Python 2.7applications, even if your organization previously used an organization policy tore-enable deployments of legacy runtimes. Your existing Python2.7 applications will continue to run and receive traffic after theirdeprecation date. We recommend thatyoumigrate to the latest supported version of Python.

Migrating Traffic

Traffic migration switches the request routing between the versions within aservice of your application, moving traffic from one or more versions to asingle new version.

For information about splitting traffic between two or more versions of yourapp, seeTraffic Splitting.

Before you begin

Before you can configure traffic to a version, ensure that your user accountincludes therequired privileges.

Migrating traffic gradually

In the standard environment, you can choose to route requests to the targetversion, either immediatelyor gradually.

By default,warmup requestsare disabled and traffic is migrated immediately to aversion.

You can also choose to enablewarmup requests if you want the trafficgradually migrated to aversion. If you immediately migrate traffic to a new version without any runninginstances then you will experience a spike in latency for loading requests.Deploying a new version with the same name as an existing version causes animmediate traffic migration. All instances of the old version are immediatelyshut down. There will be a latency spike due to loading requests for the newversion.

Note: Gradual traffic migration traffic between versions running in theflexible environment is not supported. You must migrate traffic immediately toversions that are running in the flexible environment.

If warmup requests are enabled, you can migrate traffic between versions thatreside in different environments only by specifying to migrate trafficimmediately.

Adding warmup requests to your application

When warmup requests are enabled, traffic is migrated gradually by first sendingawarmup request to new instances before those instances receive any userrequests. Warmup requests improve user response time by allowing the versioncurrently receiving traffic to handle those requests but the traffic migrationto the new version can take a short amount of time while the new instances arecreated.

When warmup requests are not enabled, user requests are sent to those newinstances before they have been created. Due to the delay caused by creatingthe new instances and loading application code, latency can occur for those userresponses.

To avoid latency and enable warmup requests, includetheinbound_services element in your configuration file before you deployyour application to App Engine.

For example, you include the following in yourapp.yaml file before deploying it to App Engine:

inbound_services:-warmup

For complete details about enabling warmup requests, seeConfiguring Warmup Requests to Improve Performance.

Migrating traffic to a new version

Console

To migrate traffic in the Google Cloud console, go to the Versions page:

Go to the Versions page

  1. Select the version to which you want to migrate 100% of the traffic.
  2. ClickMigrate traffic.
  3. Optional: When warmup requests are enabled your traffic is migrated gradually. To migrate traffic immediately, select the option under theShow advanced options section.

gcloud

After installing theGoogle Cloud CLI, you run thegcloudapp services set-trafficcommand to migrate 100% of traffic to a single version. For example:

  • To migrate traffic immediately:
    gcloudappservicesset-traffic[MY_SERVICE]--splits[MY_VERSION]=1
  • To gradually migrate traffic, you include the optional--migrate flag:
    gcloudappservicesset-traffic[MY_SERVICE]--splits[MY_VERSION]=1--migrate

API

To programmatically migrate traffic, you can use the Admin API,seeMigrating and SplittingTraffic for details.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-15 UTC.