A partir de 29 de abril de 2025, os modelos Gemini 1.5 Pro e Gemini 1.5 Flash não estarão disponíveis em projetos que não os usaram antes, incluindo novos projetos. Para mais detalhes, consulte Versões e ciclo de vida do modelo.
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Nesta etapa, você cria um balanceador de carga de aplicativo
para distribuir o tráfego para instâncias de back-end hospedadas no Cloud Run.
Na configuração do balanceador de carga, você define as regras de roteamento, que
determinam como o balanceador de carga direciona o tráfego. As regras de roteamento incluem host
regras de firewall e correspondências de caminho, que constituem os componentes de configuração de um
Mapa de URL do balanceador de carga de aplicativo.
Observe que, para concluir esta etapa, você deve ter um nome de domínio válido ou um
um certificado autogerenciado válido.
Criar um balanceador de carga para o serviço do Cloud Run
No Google Cloud console, acesse a página Balanceamento de carga.
Marque a caixa de seleção Ativar redirecionamento HTTP para HTTPS.
Clique em Concluído.
Clique em Configuração de back-end para configurar o back-end.
Configuração de back-end
Clique no botão Serviços de back-end e de buckets de back-end e clique em
Digite os seguintes detalhes:
Nome: insira gemini-streamlit-app-backend.
Tipo de back-end: clique em Grupo de endpoints de rede sem servidor.
Back-ends: no card Novo back-end, siga estas etapas:
Clique na lista Grupos de endpoints de rede sem servidor e em Criar grupo de endpoints de rede sem servidor.
Digite os seguintes detalhes:
Nome: insira streamlit-app-neg.
Região: selecione us-central1.
Tipo de grupo de endpoints de rede sem servidor: selecione Cloud Run.
Selecionar serviço: selecione o serviço gemini-streamlit-cloudrun do Cloud Run.
Clique em Criar.
Clique em Concluído.
Desmarque a caixa de seleção Ativar CDN do Cloud.
Na caixa Nome da política, digite default-security-policy-gemini-app-backend.
Clique em Criar e em OK.
Clique em Regras de roteamento para configurar as regras.
Regras de roteamento
Clique em Regra avançada de host e caminho.
Na seção Regras de host e caminho, clique em (Padrão) Encaminhar tráfego para o back-end "" para hosts sem correspondência e insira os seguintes detalhes:
Ação: selecione Encaminhar o tráfego para um back-end único.
Back-end: selecione gemini-streamlit-app-backend.
Clique em Concluído.
Clique em Adicionar regra de host e de caminho para adicionar uma nova regra.
Em Nova regra de host e caminho, insira os seguintes detalhes:
Hosts: digite o nome de domínio usado no
criando o certificado gerenciado pelo Google.
Correspondente de caminho: copie a seguinte configuração do mapa de URL:
PRIORITY: especifique a prioridade do serviço de back-end.
em que as regras de rota são avaliadas. Nesse cenário, defina esse valor como qualquer
valor porque você criou apenas um serviço de back-end.
Clique em Concluído.
Clique em Analisar e finalizar para analisar a configuração e criar o balanceador de carga.
Analisar e finalizar
Revise a configuração do balanceador de carga.
Para criar o balanceador de carga, clique em Criar.
Adicionar o endereço IP aos registros DNS do domínio
Atualize os registros DNS do seu domínio para que apontem para o endereço IP reservado que foi
criados para o balanceador de carga. Talvez seja necessário entrar em contato com o administrador
do seu domínio para concluir esta etapa.
[[["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-09-04 UTC."],[],[],null,["# Step 3: Create a load balancer\n\nIn this step, you create an [Application Load Balancer](/load-balancing/docs/application-load-balancer)\nto distribute the traffic to backend instances hosted on Cloud Run.\nIn the load balancer configuration, you define the routing rules, which\ndetermine how the load balancer directs the traffic. Routing rules include host\nrules and path matches, which constitute the configuration components of an external\nApplication Load Balancer's [URL map](/load-balancing/docs/url-map-concepts).\n\nNote that to complete this step, you must have a valid domain name or a\nvalid self-managed certificate.\n\nCreate a load balancer for the Cloud Run service\n------------------------------------------------\n\n1. In the Google Cloud console, go to the **Load balancing** page.\n\n [Go to Load balancing](https://console.cloud.google.com/net-services/loadbalancing/list/loadBalancers)\n2. Click **Create load balancer**.\n\n3. In the **Type of load balancer** section, click **Application Load Balancer (HTTP/HTTPS)** , and then click **Next**.\n\n4. In the **Public facing or internal** section, click **Public facing (external)** , and then click **Next**.\n\n5. In the **Global or single region deployment** section, click **Best for global workloads** , and then click **Next**.\n\n6. In the **Load balancer generation** section, click **Global external Application Load Balancer** , and then click **Next**.\n\n7. Click **Configure**.\n\n8. In the **Load Balancer name** field, enter `gemini-streamlit-app-lb`.\n\n9. Configure the load balancer by completing the **Frontend configuration** , **Backend configuration** , and **Routing rules** sections.\n\n### Frontend Configuration\n\n1. Specify the following **Frontend configuration**:\n\n - **Name** : Enter `gemini-streamlit-app-frontend`.\n\n - **Protocol** : Select **HTTPS (includes HTTP/2 and HTTP/3)**.\n\n - **Network Service Tier** : Set the **IP address** by [reserving a new external static IP address](/load-balancing/docs/https/setup-global-ext-https-serverless#ip-address). While reserving the new IP address, specify `genai-app-ip` as the **Name**.\n\n - **Certificate**: Perform the following steps to create a new Google-managed certificate:\n\n 1. Click **Create a new certificate**.\n\n 2. Specify the following details:\n\n - **Name** : Enter `my-genai-app-certificate`.\n\n - **Create mode** : Click **Create Google-managed certificate**.\n\n - **Domains**: Enter the domain name for provisioning the certificate.\n\n 3. Click **Create**.\n\n For more information about Google-managed SSL certificates, see\n [Use Google-managed SSL certificates](/load-balancing/docs/ssl-certificates/google-managed-certs).\n\n \u003c!-- --\u003e\n\n - Select the **Enable HTTP to HTTPS redirect** checkbox.\n2. Click **Done**.\n\n3. Click **Backend configuration** to configure the backend.\n\n### Backend configuration\n\n1. Click the **Backend services \\& backend buckets** list and then click\n CEnter the following details:\n\n - **Name** : Enter `gemini-streamlit-app-backend`.\n\n - **Backend type** : Click **Serverless network endpoint group**.\n\n - **Backends** : On the **New Backend** card, perform the following steps:\n\n 1. Click the **Serverless network endpoint groups** list, and then click **Create serverless network endpoint group**.\n\n 2. Enter the following details:\n\n - **Name** : Enter `streamlit-app-neg`.\n\n - **Region** : Select `us-central1`.\n\n - **Serverless network endpoint group type** : Select **Cloud Run**.\n\n - **Select service** : Select the `gemini-streamlit-cloudrun` Cloud Run service.\n\n 3. Click **Create**.\n\n 4. Click **Done**.\n\n2. Clear the **Enable Cloud CDN** checkbox.\n\n3. In the **Policy name** box, enter `default-security-policy-gemini-app-backend`.\n\n4. Click **Create** , and then click **OK**.\n\n5. Click **Routing rules** to configure the routing rules.\n\n### Routing rules\n\n1. Click **Advanced host and path rule**.\n\n2. In the **Host and path rules** section, click **(Default) Route traffic to backend \"\" for any unmatched hosts**, and then enter the following details:\n\n - **Action** : Select **Route traffic to a single backend**.\n\n - **Backend** : Select `gemini-streamlit-app-backend`.\n\n | **Note:** This rule handles the traffic for any unmatched host.\n3. Click **Done**.\n\n4. Click **Add host and path rule** to add a new rule.\n\n5. Under **New host and path rule**, enter the following details:\n\n - **Hosts**: Enter the domain name used while\n creating the Google-managed certificate.\n\n - **Path Matcher**: Copy the following URL map configuration:\n\n defaultService: projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/global/backendServices/gemini-streamlit-app-backend\n name: matcher1\n routeRules:\n - matchRules:\n - prefixMatch: /gemini-streamlit-app\n priority: \u003cvar translate=\"no\"\u003ePRIORITY\u003c/var\u003e\n routeAction:\n weightedBackendServices:\n - backendService: projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/global/backendServices/gemini-streamlit-app-backend\n weight: 100\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your Google Cloud project ID.\n\n - \u003cvar translate=\"no\"\u003ePRIORITY\u003c/var\u003e: Specify the priority of the backend service by\n which the route rules are evaluated. In this scenario, set this to any\n value because you created only one backend service.\n\n6. Click **Done**.\n\n7. Click **Review and finalize** to review the configuration and create the load balancer.\n\n### Review and finalize\n\n1. Review the load balancer configuration.\n\n2. To create the load balancer, click **Create**.\n\nAdd the IP address to the domain DNS records\n--------------------------------------------\n\nUpdate the DNS records of your domain to point to the reserved IP address that was\ncreated for your load balancer. You might have to contact the administrator\nof your domain to complete this step."]]