> ## Documentation Index
> Fetch the complete documentation index at: https://gcore.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage load balancers

export const MethodSection = ({children}) => children ?? null;

export const MethodSwitch = ({children}) => {
  const tabs = React.Children.toArray(children).map(c => {
    if (!c || !c.props) return null;
    if (c.props.id) return c;
    const inner = c.props.children;
    if (inner && inner.props && inner.props.id) return inner;
    return null;
  }).filter(Boolean);
  const firstId = tabs.length > 0 ? tabs[0].props.id : "";
  const [active, setActive] = React.useState(firstId);
  React.useEffect(() => {
    try {
      const saved = localStorage.getItem("gcore_docs_method");
      if (saved && tabs.find(t => t.props.id === saved)) {
        setActive(saved);
      }
    } catch (_) {}
  }, []);
  React.useEffect(() => {
    try {
      document.querySelectorAll("h2[id], h3[id]").forEach(heading => {
        const visible = heading.offsetParent !== null;
        document.querySelectorAll(`a[href="#${heading.id}"]`).forEach(link => {
          if (link.closest("h1,h2,h3,h4,h5,h6")) return;
          const li = link.closest("li");
          if (li) li.style.display = visible ? "" : "none";
        });
      });
    } catch (_) {}
    window.dispatchEvent(new Event("scroll"));
  }, [active]);
  const handleClick = id => {
    setActive(id);
    try {
      localStorage.setItem("gcore_docs_method", id);
    } catch (_) {}
  };
  return <div>
      <div className="not-prose flex gap-0 border-b border-zinc-200 dark:border-zinc-800 mb-8 mt-2" role="tablist">
        {tabs.map(tab => {
    const isActive = active === tab.props.id;
    return <button key={tab.props.id} role="tab" aria-selected={isActive} onClick={() => handleClick(tab.props.id)} className={["px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors cursor-pointer", isActive ? "border-primary text-primary" : "border-transparent text-zinc-500 hover:text-zinc-800 dark:hover:text-zinc-200"].join(" ")}>
              {tab.props.label}
            </button>;
  })}
      </div>

      {tabs.map(tab => <div key={tab.props.id} style={{
    display: active === tab.props.id ? "" : "none"
  }}>
          {tab.props.children}
        </div>)}
    </div>;
};

<MethodSwitch>
  <MethodSection id="portal" label="Customer Portal">
    <p>After a Load Balancer is created, it appears on the **Load Balancers** page in the [Gcore Customer Portal](https://portal.gcore.com). Navigate to **Cloud** > **Networking** > **Load Balancers** to open the page.</p>

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/manage-load-balancers/load-balancers-page.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=641ea75016121a9b2e16c8c15c8e6105" alt="Load Balancers page in the Customer Portal" width="1101" height="527" data-path="images/docs/cloud/networking/load-balancers/manage-load-balancers/load-balancers-page.png" />
    </Frame>

    <p>The page lists each Load Balancer with the following columns:</p>

    * **Name**: display name and brief configuration summary
    * **IP Address**: address assigned to the Load Balancer
    * **Listeners**: number of configured listening ports
    * **Region**: data center location
    * **Tags**: metadata labels assigned to the Load Balancer
    * **Created**: deployment date and time
    * **Operating status**, **Provisioning status**: see [Statuses](#statuses-of-load-balancers-and-their-components)

    <Tip>
      Use the **Search by name** field to filter the list when managing a large number of Load Balancers.
    </Tip>

    ## Statuses of load balancers and their components

    <p>A Load Balancer and its components (listener, pool, and pool member) each carry two types of statuses.</p>

    <p>**Operating status** — the current observed state:</p>

    | Status          | Meaning                                                                 |
    | --------------- | ----------------------------------------------------------------------- |
    | **Online**      | Operating normally; all pool members are healthy                        |
    | **Draining**    | Pool members are no longer accepting new connections                    |
    | **Offline**     | Load Balancer is not accepting new connections                          |
    | **Degraded**    | One or more pool members are in an error state                          |
    | **Error**       | Load Balancer has failed, or all pool members are failing health checks |
    | **No\_monitor** | No health monitor is configured; status unknown                         |

    <p>**Provisioning status** — the lifecycle stage:</p>

    | Status       | Meaning                                                                                                                                                            |
    | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
    | **Active**   | Successfully created                                                                                                                                               |
    | **Deleted**  | Successfully deleted                                                                                                                                               |
    | **Updating** | Currently being updated                                                                                                                                            |
    | **Deleting** | Currently being deleted                                                                                                                                            |
    | **Error**    | Creation failed. If an error occurs during update or deletion, [initiate a failover](#failover). Load Balancers that fail to be created are automatically deleted. |

    <Info>
      Updating the name, description, or tags does not interrupt connections or cause downtime.
    </Info>

    ### Load balancer impact on availability

    <p>Adding or removing listeners and pools, and modifying listener properties, do not affect active connections. Two operations terminate all existing connections: changing the flavor and initiating a failover.</p>

    | Operation                     | Terminates connections |
    | ----------------------------- | ---------------------- |
    | Adding a listener             | No                     |
    | Modifying listener properties | No                     |
    | Adding a pool                 | No                     |
    | Removing a listener           | No                     |
    | Changing flavor               | Yes                    |
    | Initiating failover           | Yes                    |

    <p>Schedule flavor changes and failover operations during a maintenance window to minimize disruption.</p>

    ## Load balancer settings

    <p>Click a Load Balancer's name on the list page to open its detail view. The top section always shows the routing scheme, VIP address, Floating IP (if configured), and current statuses. The lower section is organized into tabs.</p>

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/manage-load-balancers/balancer-overview.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=226347c2fad3456f213340f011dd02f5" alt="Load Balancers overview page" width="1098" height="570" data-path="images/docs/cloud/networking/load-balancers/manage-load-balancers/balancer-overview.png" />
    </Frame>

    <p>Top-section fields:</p>

    * **Routing scheme**: visualization of traffic flow through the Load Balancer — ingress and egress paths
    * **Type**: network distribution type — external (public) or private
    * **VIPs**: virtual IP address of the Load Balancer
    * **Floating IP**: Floating IP assigned during creation, if configured
    * **Operating status**, **Provisioning status**: see [Statuses](#statuses-of-load-balancers-and-their-components)

    ### Flavor

    <p>The **Flavor** tab shows the load balancer's current configuration and real-time resource metrics.</p>

    <Warning>
      Changing the flavor terminates all current connections. Schedule resize operations during a maintenance window.
    </Warning>

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/manage-load-balancers/flavor-tab.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=f7b11367007cb3c3003bdf201e0f1e96" alt="Flavor tab in Load Balancer settings" width="1101" height="566" data-path="images/docs/cloud/networking/load-balancers/manage-load-balancers/flavor-tab.png" />
    </Frame>

    * **Flavor**: configuration name defining the vCPU and RAM allocation
    * **vCPU**: number of virtual CPU cores
    * **RAM**: RAM in Gibibytes (GiB)
    * **ID**: unique Load Balancer identifier
    * **Active connections**: ongoing connections currently handled
    * **Bytes in**: total data received
    * **Bytes out**: total data sent
    * **Request errors**: errors encountered during request handling
    * **Total connections**: cumulative connections since creation

    ### Monitoring

    <p>The **Monitoring** tab shows performance metrics for assessing health and capacity. Data is available in hourly views (1, 6, or 24 hours) and weekly views (1 or 2 weeks). The auto-refresh interval can be set to 1, 5, 15, or 30 minutes, or one hour.</p>

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/manage-load-balancers/monitoring-tab.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=58e37413b2d95ce4dd5aba4b983e7b95" alt="Monitoring tab in Load Balancer settings" width="1101" height="837" data-path="images/docs/cloud/networking/load-balancers/manage-load-balancers/monitoring-tab.png" />
    </Frame>

    * **CPU Utilization, %**: percentage of CPU currently in use. High values indicate the Load Balancer is nearing capacity, typically from high connection volume or traffic.
    * **RAM Utilization, %**: percentage of memory in use. Terminated HTTPS traffic consumes more RAM than other traffic types.
    * **Network traffic**: ingress and egress traffic rate in kbit/s.
    * **Network packets**: packet rate (PPS) for ingress and egress.

    ### Listeners

    <p>A listener is a process that monitors a configured protocol and port for incoming connections and forwards traffic to an assigned pool.</p>

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/manage-load-balancers/listeners-tab.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=227173ab9c721014436c2b6afefa25ec" alt="Listeners tab in Load Balancer settings" width="1400" height="900" data-path="images/docs/cloud/networking/load-balancers/manage-load-balancers/listeners-tab.png" />
    </Frame>

    <p>Each listener shows:</p>

    * **Name**: listener name
    * **Protocol**: network protocol handled by the listener
    * **Port**: port monitored for incoming connections
    * **Pools**: number of attached backend pools
    * **Operating status**: current operational state
    * **Provisioning status**: configuration lifecycle state

    <Info>
      Multiple listeners with the same L4 type and port cannot coexist. TCP 80 and UDP 80 can run together, but two TCP 80 listeners cannot. HTTP 80 and TCP 80 also conflict because HTTP operates over TCP.
    </Info>

    #### Pool settings

    <Tip>
      To apply multiple pool changes in one operation, use the [Gcore API](/api-reference/cloud#tag/Load-Balancers/operation/LoadBalancerPoolInstanceViewSet.patch).
    </Tip>

    <p>A pool is the set of Virtual Machines or Bare Metal servers to which a listener forwards traffic.</p>

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/manage-load-balancers/listeners-tab-pool.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=97bd53a0af43fb9d04f9d52d1120fadf" alt="Listeners tab with pool settings" width="1400" height="900" data-path="images/docs/cloud/networking/load-balancers/manage-load-balancers/listeners-tab-pool.png" />
    </Frame>

    <p>Each pool shows:</p>

    * **Name**: pool name
    * **Algorithm**: traffic distribution method — see [pool settings](/cloud/networking/create-and-configure-a-load-balancer#pool) for available options
    * **Instance count**: number of backend instances
    * **Health Check**: health monitoring method
    * **Operating status**: current operational state
    * **Provisioning status**: configuration lifecycle state

    <p>Instances in each pool:</p>

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/manage-load-balancers/listeners-tab-instances.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=5511045e5559f5b2072cd572568aa649" alt="Listeners tab with instance settings" width="1400" height="900" data-path="images/docs/cloud/networking/load-balancers/manage-load-balancers/listeners-tab-instances.png" />
    </Frame>

    * **State**: whether the instance is enabled or disabled within the pool
    * **Address**: IP address the Load Balancer uses to forward traffic to this instance
    * **Port**: port the instance listens on
    * **Operating status**: current operational state
    * **Provisioning status**: configuration lifecycle state

    <p>Health check configuration:</p>

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/manage-load-balancers/listeners-tab-health-check.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=5e990e5cdd04290980d1208b0858a6c5" alt="Listeners tab with health check settings" width="1400" height="900" data-path="images/docs/cloud/networking/load-balancers/manage-load-balancers/listeners-tab-health-check.png" />
    </Frame>

    * **State**: whether health monitoring is enabled for the pool
    * **Type**: health check method (TCP, HTTP, HTTPS, PING, TLS-HELLO, UDP-CONNECT)
    * **Operating status**: current operational state of the health monitor
    * **Provisioning status**: configuration lifecycle state

    #### L7 policies

    <p>An L7 policy specifies how to route incoming traffic at the application layer (Layer 7 of the [OSI model](https://en.wikipedia.org/wiki/OSI_model)).</p>

    #### Listener statistics

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/manage-load-balancers/listener-stats.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=411915b646a47df88cab9cd18c7c407b" alt="Listeners tab with listener statistics" width="1400" height="900" data-path="images/docs/cloud/networking/load-balancers/manage-load-balancers/listener-stats.png" />
    </Frame>

    * **Name**: listener name
    * **Active connections**: ongoing connections to the listener
    * **Bytes in**: total data received
    * **Bytes out**: total data sent
    * **Request errors**: total request errors
    * **Total connections**: cumulative connections since listener creation

    ### Configuration

    <p>The **Configuration** tab sets the Load Balancer flavor. Select a different flavor to resize the Load Balancer.</p>

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/manage-load-balancers/configuration-tab.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=2449f6d842b5e1e8de33d0d1f4ac4b95" alt="Configuration tab settings" width="1400" height="900" data-path="images/docs/cloud/networking/load-balancers/manage-load-balancers/configuration-tab.png" />
    </Frame>

    ### Logging

    <p>The **Logging** tab records detailed traffic information for debugging, monitoring, and analysis. The [Logging for Load Balancers](/cloud/networking/load-balancers/logging-for-load-balancers) article covers all available settings.</p>

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/manage-load-balancers/logging-tab.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=37082864ae9e1933419ecc3d1f4d2344" alt="Logging tab settings" width="1100" height="561" data-path="images/docs/cloud/networking/load-balancers/manage-load-balancers/logging-tab.png" />
    </Frame>

    ### Tags

    <p>The **Tags** tab displays and manages metadata assigned to a Load Balancer. Tags group related resources — for example, Load Balancers belonging to the same service (authentication, shop, cart) can share a tag to make them easy to identify and manage together.</p>

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/manage-load-balancers/custom-tags-tab.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=3a4c481a82e2e2d5b20a2a02986a76ff" alt="Tags tab settings" width="1089" height="513" data-path="images/docs/cloud/networking/load-balancers/manage-load-balancers/custom-tags-tab.png" />
    </Frame>

    ### Advanced DDoS Protection

    <p>The **Advanced DDoS Protection** tab configures DDoS mitigation policies for the Load Balancer.</p>

    ## Limits

    <p>The following limits apply per Load Balancer:</p>

    | Component           | Limit                     |
    | ------------------- | ------------------------- |
    | Load Balancers      | Managed by Quotas         |
    | Listeners           | 50 (excluding Prometheus) |
    | Prometheus Listener | 1                         |
    | Pools               | 50                        |
    | Members             | 2500                      |

    <Info>
      * Large pools are supported; a single pool can contain 1000–2000 members. The total member count per Load Balancer cannot exceed 2500.
      * Pools attach directly to either a listener or a Load Balancer, with a maximum of one pool per listener.
    </Info>

    ## Failover

    <p>Use failover to redirect traffic from a degraded or failed Load Balancer to a standby instance. The switchover completes in a few minutes.</p>

    <Warning>
      Failover terminates all current connections. Schedule it during a maintenance window for production Load Balancers.
    </Warning>

    1. Navigate to **Cloud** > **Networking** > **Load Balancers**.

    2. Click the Load Balancer name to open it.

    3. Click **Actions** > **Failover**.

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/manage-load-balancers/failover.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=bf11ddac180f8af146024d3e8857fb35" alt="Actions dropdown with Failover option" width="1100" height="576" data-path="images/docs/cloud/networking/load-balancers/manage-load-balancers/failover.png" />
    </Frame>

    4. (Optional) To force failover regardless of provisioning status, enable **Ignore Load Balancer provisioning status**.

    5. Click **Initiate Failover**.

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/manage-load-balancers/initiating-failover.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=4ae3743ff11179c5ab507564617affa0" alt="Failover confirmation dialog" width="591" height="376" data-path="images/docs/cloud/networking/load-balancers/manage-load-balancers/initiating-failover.png" />
    </Frame>

    <p>The failover takes a few minutes. The provisioning status changes to **Updating** during this time.</p>

    ## Rename a load balancer

    1. Navigate to **Cloud** > **Networking** > **Load Balancers**.

    2. Click the three-dot icon next to the Load Balancer to rename.

    3. Select **Rename**.

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/manage-load-balancers/rename.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=f30c549869655b8e8609f6d4b312ee8e" alt="Three-dot menu showing Rename option" width="1101" height="568" data-path="images/docs/cloud/networking/load-balancers/manage-load-balancers/rename.png" />
    </Frame>

    4. Enter a new name and click **Save**.

    ## Edit tags

    1. Navigate to **Cloud** > **Networking** > **Load Balancers**.

    2. Click the Load Balancer name to open its settings.

    3. Navigate to the **Tags** tab.

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/manage-load-balancers/custom-tags-tab.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=3a4c481a82e2e2d5b20a2a02986a76ff" alt="Tags tab settings" width="1089" height="513" data-path="images/docs/cloud/networking/load-balancers/manage-load-balancers/custom-tags-tab.png" />
    </Frame>

    4. Update tags and click **Save**.

    ## Delete a load balancer

    1. Navigate to **Cloud** > **Networking** > **Load Balancers**.

    2. Click the three-dot icon next to the Load Balancer to delete.

    3. Select **Delete**.

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/manage-load-balancers/delete-three-dot-icon.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=aaf9321a5ed067dba626cd5b6a9eab0c" alt="Three-dot menu showing Delete option" width="1099" height="575" data-path="images/docs/cloud/networking/load-balancers/manage-load-balancers/delete-three-dot-icon.png" />
    </Frame>

    4. Click **Delete** to confirm.
  </MethodSection>

  <MethodSection id="api" label="REST API">
    <p>After a load balancer is deployed, you can inspect its configuration, update metadata, initiate a failover, or remove it. The examples below cover each of these day-two operations.</p>

    <Info>
      An [API token](/account-settings/api-tokens) is required, along with a [project ID](/api-reference/cloud/projects/list-projects), a [region ID](/api-reference/cloud/regions/list-regions), and the ID of an existing [load balancer](/cloud/networking/create-and-configure-a-load-balancer).
    </Info>

    <p>Open a bash terminal and set these as environment variables before running the examples:</p>

    ```bash theme={null}
    export GCORE_API_KEY="{YOUR_API_KEY}"
    export GCORE_CLOUD_PROJECT_ID="{YOUR_PROJECT_ID}"
    export GCORE_CLOUD_REGION_ID="{YOUR_REGION_ID}"
    export LB_ID="{YOUR_LOAD_BALANCER_ID}"
    ```

    ## List load balancers

    <p>Listing returns all load balancers in the region with their operating status, provisioning status, and VIP address.</p>

    <Tabs>
      <Tab title="Python SDK">
        ```python theme={null}
        import os
        from gcore import Gcore

        client = Gcore()

        page = client.cloud.load_balancers.list()
        print(f"Total: {page.count}")
        for lb in page.results:
            print(f"  {lb.id}  {lb.name}  {lb.operating_status}  {lb.vip_address}")
        ```
      </Tab>

      <Tab title="Go SDK">
        ```go theme={null}
        import (
            "context"
            "fmt"
            "log"
            "os"
            gcore "github.com/G-Core/gcore-go"
            "github.com/G-Core/gcore-go/cloud"
        )

        client := gcore.NewClient()
        ctx := context.Background()

        page, err := client.Cloud.LoadBalancers.List(ctx, cloud.LoadBalancerListParams{})
        if err != nil {
            log.Fatal(err)
        }
        fmt.Printf("Total: %d\n", page.Count)
        for _, lb := range page.Results {
            fmt.Printf("  %s  %s  %s  %s\n", lb.ID, lb.Name, lb.OperatingStatus, lb.VipAddress)
        }
        ```
      </Tab>

      <Tab title="curl">
        ```bash theme={null}
        curl "https://api.gcore.com/cloud/v1/loadbalancers/$GCORE_CLOUD_PROJECT_ID/$GCORE_CLOUD_REGION_ID" \
          -H "Authorization: APIKey $GCORE_API_KEY"
        ```

        Response:

        ```json theme={null}
        {
          "count": 2,
          "results": [
            {
              "id": "ae7def79-f507-4306-93be-7784edad9211",
              "name": "my-load-balancer",
              "vip_address": "85.234.84.175",
              "operating_status": "ONLINE",
              "provisioning_status": "ACTIVE",
              "listeners": [],
              "tags_v2": []
            }
          ]
        }
        ```
      </Tab>
    </Tabs>

    ## Get load balancer details

    <p>Fetching a single load balancer returns the full configuration including flavor, VRRP IPs, listener list, tags, and logging settings.</p>

    <Tabs>
      <Tab title="Python SDK">
        ```python theme={null}
        import os
        from gcore import Gcore

        client = Gcore()

        lb = client.cloud.load_balancers.get(load_balancer_id=os.environ["LB_ID"])
        print(f"name: {lb.name}")
        print(f"flavor: {lb.flavor.flavor_name}  vCPU: {lb.flavor.vcpus}  RAM: {lb.flavor.ram} MB")
        print(f"vip_address: {lb.vip_address}")
        print(f"operating_status: {lb.operating_status}")
        print(f"provisioning_status: {lb.provisioning_status}")
        print(f"listeners: {len(lb.listeners)}")
        for tag in lb.tags_v2:
            print(f"  tag: {tag.key}={tag.value}")
        ```
      </Tab>

      <Tab title="Go SDK">
        ```go theme={null}
        lb, err := client.Cloud.LoadBalancers.Get(ctx, os.Getenv("LB_ID"), cloud.LoadBalancerGetParams{})
        if err != nil {
            log.Fatal(err)
        }
        fmt.Printf("name: %s\n", lb.Name)
        fmt.Printf("flavor: %s  vCPU: %d  RAM: %d MB\n",
            lb.Flavor.FlavorName, lb.Flavor.Vcpus, lb.Flavor.Ram)
        fmt.Printf("vip_address: %s\n", lb.VipAddress)
        fmt.Printf("operating_status: %s  provisioning_status: %s\n",
            lb.OperatingStatus, lb.ProvisioningStatus)
        fmt.Printf("listeners: %d\n", len(lb.Listeners))
        ```
      </Tab>

      <Tab title="curl">
        ```bash theme={null}
        curl "https://api.gcore.com/cloud/v1/loadbalancers/$GCORE_CLOUD_PROJECT_ID/$GCORE_CLOUD_REGION_ID/$LB_ID" \
          -H "Authorization: APIKey $GCORE_API_KEY"
        ```

        Response:

        ```json theme={null}
        {
          "id": "ae7def79-f507-4306-93be-7784edad9211",
          "name": "my-load-balancer",
          "flavor": {
            "flavor_name": "lb1-1-2",
            "vcpus": 1,
            "ram": 2048
          },
          "vip_address": "85.234.84.175",
          "vip_ip_family": "ipv4",
          "operating_status": "ONLINE",
          "provisioning_status": "ACTIVE",
          "listeners": [],
          "tags_v2": [],
          "logging": { "enabled": false }
        }
        ```
      </Tab>
    </Tabs>

    ## Rename a load balancer and update tags

    <p>A single PATCH request accepts any combination of `name` and `tags` — omitted fields remain unchanged. The operation returns a task ID and completes in under 30 seconds.</p>

    | Parameter | Required | Description                                                                  |
    | --------- | -------- | ---------------------------------------------------------------------------- |
    | `name`    | No       | New name for the load balancer                                               |
    | `tags`    | No       | Key-value pairs to add or update tags; set a value to `null` to remove a tag |

    <Tabs>
      <Tab title="Python SDK">
        ```python theme={null}
        import os
        from gcore import Gcore

        client = Gcore()

        updated = client.cloud.load_balancers.update(
            load_balancer_id=os.environ["LB_ID"],
            name="my-lb-production",
            tags={"env": "production", "owner": "platform-team"},
        )
        print(f"name: {updated.name}")
        for tag in updated.tags_v2:
            print(f"  {tag.key}={tag.value}")
        ```
      </Tab>

      <Tab title="Go SDK">
        ```go theme={null}
        tagVal := func(s string) *string { return &s }
        updated, err := client.Cloud.LoadBalancers.Update(ctx, os.Getenv("LB_ID"),
            cloud.LoadBalancerUpdateParams{
                Name: gcore.String("my-lb-production"),
                Tags: cloud.TagUpdateMap{
                    "env":   tagVal("production"),
                    "owner": tagVal("platform-team"),
                },
            },
        )
        if err != nil {
            log.Fatal(err)
        }
        fmt.Printf("name: %s\n", updated.Name)
        ```
      </Tab>

      <Tab title="curl">
        ```bash theme={null}
        curl -X PATCH "https://api.gcore.com/cloud/v2/loadbalancers/$GCORE_CLOUD_PROJECT_ID/$GCORE_CLOUD_REGION_ID/$LB_ID" \
          -H "Authorization: APIKey $GCORE_API_KEY" \
          -H "Content-Type: application/json" \
          -d '{
            "name": "my-lb-production",
            "tags": {"env": "production", "owner": "platform-team"}
          }'
        ```

        Response:

        ```json theme={null}
        { "tasks": ["4acb6832-e3ef-4166-9d01-7a8b90986697"] }
        ```

        Poll <code>GET /cloud/v1/tasks/{task_id}</code> every 5 seconds until `state` is `FINISHED`.
      </Tab>
    </Tabs>

    ## Initiate a failover

    <p>Failover redirects traffic to a standby load balancer instance when the active one fails or degrades. All active connections are terminated during the switchover, which takes 1-2 minutes.</p>

    <Warning>
      Failover terminates all existing connections. Schedule it during a maintenance window for production load balancers.
    </Warning>

    | Parameter | Required | Description                                                               |
    | --------- | -------- | ------------------------------------------------------------------------- |
    | `force`   | No       | Set to `true` to force failover regardless of current provisioning status |

    <Tabs>
      <Tab title="Python SDK">
        ```python theme={null}
        import os
        from gcore import Gcore

        client = Gcore()

        t = client.cloud.load_balancers.failover(load_balancer_id=os.environ["LB_ID"])
        client.cloud.tasks.poll(t.tasks[0])
        print("Failover complete.")
        ```
      </Tab>

      <Tab title="Go SDK">
        ```go theme={null}
        t, err := client.Cloud.LoadBalancers.Failover(ctx, os.Getenv("LB_ID"),
            cloud.LoadBalancerFailoverParams{},
        )
        if err != nil {
            log.Fatal(err)
        }
        if err = client.Cloud.Tasks.Poll(ctx, t.Tasks[0]); err != nil {
            log.Fatal(err)
        }
        fmt.Println("Failover complete.")
        ```
      </Tab>

      <Tab title="curl">
        ```bash theme={null}
        curl -X POST "https://api.gcore.com/cloud/v1/loadbalancers/$GCORE_CLOUD_PROJECT_ID/$GCORE_CLOUD_REGION_ID/$LB_ID/failover" \
          -H "Authorization: APIKey $GCORE_API_KEY" \
          -H "Content-Type: application/json" \
          -d '{}'
        ```

        Response:

        ```json theme={null}
        { "tasks": ["d68abcfd-80ad-416a-840e-861f0c26d11c"] }
        ```

        Poll <code>GET /cloud/v1/tasks/{task_id}</code> every 5 seconds until `state` is `FINISHED`. Failover takes 1-2 minutes.
      </Tab>
    </Tabs>

    ## Delete a load balancer

    <p>Deleting a load balancer removes it and its configuration permanently. The operation is asynchronous and takes about 30 seconds.</p>

    <Tabs>
      <Tab title="Python SDK">
        ```python theme={null}
        import os
        from gcore import Gcore

        client = Gcore()

        client.cloud.load_balancers.delete_and_poll(load_balancer_id=os.environ["LB_ID"])
        print("Load balancer deleted.")
        ```
      </Tab>

      <Tab title="Go SDK">
        ```go theme={null}
        if err = client.Cloud.LoadBalancers.DeleteAndPoll(ctx, os.Getenv("LB_ID"),
            cloud.LoadBalancerDeleteParams{},
        ); err != nil {
            log.Fatal(err)
        }
        fmt.Println("Load balancer deleted.")
        ```
      </Tab>

      <Tab title="curl">
        ```bash theme={null}
        curl -X DELETE "https://api.gcore.com/cloud/v1/loadbalancers/$GCORE_CLOUD_PROJECT_ID/$GCORE_CLOUD_REGION_ID/$LB_ID" \
          -H "Authorization: APIKey $GCORE_API_KEY"
        ```

        Response:

        ```json theme={null}
        { "tasks": ["89316ade-d4af-4b07-97b5-acf2e3df6148"] }
        ```

        Poll <code>GET /cloud/v1/tasks/{task_id}</code> every 5 seconds until `state` is `FINISHED`.
      </Tab>
    </Tabs>
  </MethodSection>

  <MethodSection id="terraform" label="Terraform">
    <p>Query existing load balancers or update a managed one. The [provider v2](/developer-tools/terraform/overview) exposes both a resource and a data source for [`gcore_cloud_load_balancer`](https://registry.terraform.io/providers/G-Core/gcore/latest/docs/resources/cloud_load_balancer).</p>

    <Info>
      An [API token](/account-settings/api-tokens) is required, along with a [project ID](/api-reference/cloud/projects/list-projects) and [region ID](/api-reference/cloud/regions/list-regions).
    </Info>

    ## List load balancers

    <p>Use the `gcore_cloud_load_balancers` data source to retrieve all balancers in a region:</p>

    ```hcl theme={null}
    data "gcore_cloud_load_balancers" "all" {
      project_id = var.project_id
      region_id  = var.region_id
    }

    output "load_balancers" {
      value = [for lb in data.gcore_cloud_load_balancers.all.items : {
        id               = lb.id
        name             = lb.name
        vip_address      = lb.vip_address
        operating_status = lb.operating_status
      }]
    }
    ```

    <p>Run `terraform plan` to display the list.</p>

    ## Get load balancer details

    <p>Use the `gcore_cloud_load_balancer` data source to read the full configuration of a balancer by its ID:</p>

    ```hcl theme={null}
    variable "lb_id" { type = string }

    data "gcore_cloud_load_balancer" "existing" {
      project_id       = var.project_id
      region_id        = var.region_id
      load_balancer_id = var.lb_id
    }

    output "lb_details" {
      value = {
        name                = data.gcore_cloud_load_balancer.existing.name
        vip_address         = data.gcore_cloud_load_balancer.existing.vip_address
        operating_status    = data.gcore_cloud_load_balancer.existing.operating_status
        provisioning_status = data.gcore_cloud_load_balancer.existing.provisioning_status
      }
    }
    ```

    ## Modify a managed load balancer

    <p>To rename, retag, or resize a load balancer that Terraform manages, update the relevant attributes and run `terraform apply`:</p>

    ```hcl theme={null}
    resource "gcore_cloud_load_balancer" "example" {
      project_id = var.project_id
      region_id  = var.region_id
      name       = "my-lb-production"  # rename
      flavor     = "lb1-2-4"           # resize

      tags = {
        env   = "production"
        owner = "platform-team"
      }
    }
    ```

    <p>Rename and tag updates complete in under 30 seconds and do not interrupt traffic.</p>

    <Warning>
      Changing the `flavor` attribute resizes the load balancer and terminates all active connections. Schedule flavor changes during a maintenance window.
    </Warning>

    ## Failover

    <p>Failover is an operational trigger. Use the [Customer Portal](#portal) or [REST API](#api) tab to initiate it.</p>

    ## Delete a load balancer

    <p>Remove the load balancer resource block and all associated listener and pool blocks — Terraform deletes them in the correct dependency order on the next `terraform apply`.</p>

    ```hcl theme={null}
    # Remove or comment out all blocks:
    # resource "gcore_cloud_load_balancer_pool" "backend" { ... }
    # resource "gcore_cloud_load_balancer_listener" "http" { ... }
    # resource "gcore_cloud_load_balancer" "example" { ... }
    ```

    ```bash theme={null}
    terraform apply
    ```
  </MethodSection>
</MethodSwitch>
