A partire dal 29 aprile 2025, i modelli Gemini 1.5 Pro e Gemini 1.5 Flash non sono disponibili nei progetti che non li hanno mai utilizzati, inclusi i nuovi progetti. Per maggiori dettagli, vedi Versioni e ciclo di vita dei modelli.
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
In questo passaggio, crei un bilanciatore del carico delle applicazioni per distribuire il traffico alle istanze di backend ospitate su Cloud Run.
Nella configurazione del bilanciatore del carico, definisci le regole di routing, che determinano come il bilanciatore del carico indirizza il traffico. Le regole di routing includono regole host e corrispondenze percorso, che costituiscono i componenti di configurazione della mappa URL di un bilanciatore del carico delle applicazioni esterno.
Tieni presente che per completare questo passaggio devi disporre di un nome di dominio valido o di un certificato autogestito valido.
Crea un bilanciatore del carico per il servizio Cloud Run
Nella Google Cloud console, vai alla pagina Bilanciamento del carico.
Seleziona la casella di controllo Attiva il reindirizzamento da HTTP a HTTPS.
Fai clic su Fine.
Fai clic su Configurazione backend per configurare il backend.
Configurazione backend
Fai clic sull'elenco Servizi e bucket di backend, quindi su
Inserisci i seguenti dettagli:
Nome: inserisci gemini-streamlit-app-backend.
Tipo di backend: fai clic su Gruppo di endpoint di rete serverless.
Backend: nella scheda Nuovo backend, segui questi passaggi:
Fai clic sull'elenco Gruppi di endpoint di rete serverless e poi su Crea gruppo di endpoint di rete serverless.
Inserisci i seguenti dettagli:
Nome: inserisci streamlit-app-neg.
Regione: seleziona us-central1.
Tipo di gruppo di endpoint di rete serverless: seleziona Cloud Run.
Seleziona servizio: seleziona il servizio Cloud Run gemini-streamlit-cloudrun.
Fai clic su Crea.
Fai clic su Fine.
Deseleziona la casella di controllo Abilita Cloud CDN.
Nella casella Nome criterio, inserisci default-security-policy-gemini-app-backend.
Fai clic su Crea, quindi su OK.
Fai clic su Regole di routing per configurare le regole di routing.
Regole di routing
Fai clic su Regola avanzata per host e percorso.
Nella sezione Regole host e percorso, fai clic su (Predefinito) Instrada il traffico al backend "" per qualsiasi host senza corrispondenza e inserisci i seguenti dettagli:
Azione: seleziona Instrada il traffico a un singolo backend.
Backend: seleziona gemini-streamlit-app-backend.
Fai clic su Fine.
Fai clic su Aggiungi regola host e percorso per aggiungere una nuova regola.
In Nuova regola host e percorso, inserisci i seguenti dettagli:
Host: inserisci il nome di dominio utilizzato durante la creazione del certificato gestito da Google.
Path Matcher (Matcher percorso): copia la seguente configurazione della mappa URL:
PRIORITY: specifica la priorità del servizio di backend in base alla quale vengono valutate le regole di route. In questo scenario, imposta un valore qualsiasi perché hai creato un solo servizio di backend.
Fai clic su Fine.
Fai clic su Esamina e finalizza per esaminare la configurazione e creare il bilanciatore del carico.
Esamina e finalizza
Esamina la configurazione del bilanciatore del carico.
Per creare il bilanciatore del carico, fai clic su Crea.
Aggiungi l'indirizzo IP ai record DNS del dominio
Aggiorna i record DNS del tuo dominio in modo che rimandino all'indirizzo IP riservato creato per il bilanciatore del carico. Per completare questo passaggio, potresti dover contattare l'amministratore del tuo dominio.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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."]]