Stay organized with collections
Save and categorize content based on your preferences.
Traffic migration switches the request routing between the versions within a
service of your application, moving traffic from one or more versions to a
single new version.
Traffic is migrated immediately between your versions in the
flexible environment. Unlike versions in the standard environment,
gradual traffic migration
is not supported in the flexible environment.
If you immediately migrate traffic to a new version without any running
instances then your app will have a spike in latency while instances are being
created. You can avoid a spike in latency by using the
App Engine Admin API to provision
sufficient instances of the new app's version before you migrate traffic to it.
Set minTotalInstances
for the new version to the number needed to handle expected traffic. After
migration is complete, you can reset this field so that autoscaling occurs
if traffic drops.
You can split traffic between versions of your app, increasing the amount of
traffic a version receives in stages.
For information about splitting traffic between two or more versions of your
app, see Traffic Splitting.
Before you begin
Before you can configure traffic to a version, ensure that your user account
includes the required privileges.
Migrating traffic to a new version
Console
To migrate traffic in the Google Cloud console, go to the Versions page:
Select the version to which you want to migrate 100% of the traffic.
Click Migrate traffic.
Optional: When warmup requests are enabled your traffic is
migrated gradually. To migrate traffic immediately, select the option
under the Show advanced options section.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[[["\u003cp\u003eTraffic migration in the flexible environment allows you to immediately switch request routing from one or more versions of your application to a single new version.\u003c/p\u003e\n"],["\u003cp\u003eTo prevent latency spikes, provision sufficient instances of the new version using the App Engine Admin API before migrating traffic, and set \u003ccode\u003eminTotalInstances\u003c/code\u003e accordingly.\u003c/p\u003e\n"],["\u003cp\u003eTraffic can be migrated using the Google Cloud console, the \u003ccode\u003egcloud app services set-traffic\u003c/code\u003e command, or programmatically through the Admin API.\u003c/p\u003e\n"],["\u003cp\u003eGradual traffic migration is an option through the use of the \u003ccode\u003emigrate\u003c/code\u003e flag or the enabling of warmup requests, and can be configured from the console or through the \u003ccode\u003egcloud\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eEnsure your user account has the necessary privileges to configure traffic before you begin migrating traffic to a new version.\u003c/p\u003e\n"]]],[],null,["# Migrating traffic\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nTraffic migration switches the request routing between the versions within a\nservice of your application, moving traffic from one or more versions to a\nsingle new version.\n\nTraffic is migrated immediately between your versions in the\nflexible environment. Unlike versions in the standard environment,\n[gradual traffic migration](/appengine/docs/standard/migrating-traffic)\nis not supported in the flexible environment.\n\nIf you immediately migrate traffic to a new version without any running\ninstances then your app will have a spike in latency while instances are being\ncreated. You can avoid a spike in latency by using the\n[App Engine Admin API](/appengine/docs/admin-api) to provision\nsufficient instances of the new app's version before you migrate traffic to it.\n\nSet [`minTotalInstances`](/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#automaticscaling)\nfor the new version to the number needed to handle expected traffic. After\nmigration is complete, you can reset this field so that autoscaling occurs\nif traffic drops.\n\nYou can split traffic between versions of your app, increasing the amount of\ntraffic a version receives in stages.\n\n\nFor information about splitting traffic between two or more versions of your\napp, see [Traffic Splitting](/appengine/docs/flexible/splitting-traffic).\n\nBefore you begin\n----------------\n\nBefore you can configure traffic to a version, ensure that your user account\nincludes the [required privileges](/appengine/docs/flexible/access-control#basic_roles).\n\nMigrating traffic to a new version\n----------------------------------\n\n### Console\n\nTo migrate traffic in the Google Cloud console, go to the Versions page:\n\n[Go to Versions](https://console.cloud.google.com/appengine/versions)\n\n1. Select the version to which you want to migrate 100% of the traffic.\n2. Click **Migrate traffic**.\n3. Optional: When warmup requests are enabled your traffic is migrated gradually. To migrate traffic immediately, select the option under the **Show advanced options** section.\n\n### gcloud\n\nAfter installing the [Google Cloud CLI](/sdk/docs), you run the [`gcloud\napp services set-traffic`](/sdk/gcloud/reference/app/services/set-traffic)\ncommand to migrate 100% of traffic to a single version. For example:\n\n- To migrate traffic immediately: \n\n ```bash\n gcloud app services set-traffic [MY_SERVICE] --splits [MY_VERSION]=1\n ```\n- To gradually migrate traffic, you include the optional `--migrate` flag: \n\n ```bash\n gcloud app services set-traffic [MY_SERVICE] --splits [MY_VERSION]=1 --migrate\n ```\n\n### API\n\nTo programmatically migrate traffic, you can use the Admin API,\nsee [Migrating and Splitting\nTraffic](/appengine/docs/admin-api/migrating-splitting-traffic) for details."]]