Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
A migração de tráfego altera o roteamento de solicitações de um serviço do aplicativo ao transferir o tráfego de uma ou mais versões para uma única versão nova.
O tráfego é migrado imediatamente de uma versão para outra no ambiente flexível. Ao contrário das versões no ambiente padrão, a migração de tráfego gradual não é compatível com o ambiente flexível.
Se você migrar imediatamente o tráfego para uma nova versão sem nenhuma instância em execução, seu aplicativo terá um aumento na latência durante a criação das instâncias. Para evitar um aumento na latência, use a API Admin do App Engine para provisionar instâncias suficientes da nova versão do aplicativo antes de migrar o tráfego para ela.
Defina o minTotalInstances da nova versão com o número necessário para lidar com o tráfego esperado. Após a migração, redefina esse campo para que o escalonamento automático ocorra se o tráfego cair.
É possível dividir o tráfego entre as versões do seu aplicativo, aumentando a quantidade de tráfego que uma versão recebe em etapas.
Para informações sobre como dividir tráfego entre duas ou mais versões do aplicativo, consulte Como dividir tráfego.
Antes de começar
Antes de configurar o tráfego para uma versão, verifique se a conta de usuário inclui os privilégios obrigatórios.
Como migrar tráfego para uma nova versão
Console
Para migrar o tráfego no console Google Cloud , acesse a página "Versões":
Selecione a versão que você quer que receba 100% do tráfego.
Clique em Migrar tráfego.
Opcional: quando as solicitações de aquecimento estão ativas, o tráfego é migrado gradualmente. Para migrar o tráfego imediatamente, selecione a opção na seção Mostrar opções avançadas.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-11 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."]]