---
title: "Create a target group"
sidebar_label: "Create a target group"
sidebar_position: 1
description: "How to create and configure a target group"
---

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'
import {TabItemLabel} from '@selectel/docux/components'
import MoreVerticalIcon from '@selectel/docux/icons/more-vertical'
import Formbricks from '@theme/MDXComponents/Formbricks'

# Create a target group

<Tabs queryString="create-target-group">
  <TabItem value="panel" default>
    <TabItemLabel>
      Control panel
    </TabItemLabel>

    1. In the [Control panel](https://my.selectel.ru/vpc/default/lbaas/load-balancers/), on the top menu, click **Products** and select **Cloud Servers**.

    2. Go to the **Load Balancers** section → **Target groups** tab.

    3. Click **Create target group**.

    4. Select a [location](/infrastructure/locations.mdx) where the [target group](/cloud-servers/load-balancers/about-load-balancers.mdx#target-groups) will be created. The load balancer and target group must be in the same location.

    5. Select a load balancer.

    6. Select the traffic destination protocol that the load balancer will use to forward traffic to the target group. The following protocol combinations are available for receiving traffic on the load balancer and forwarding traffic to the target group:

       * TCP–TCP — classic L4 load balancing;
       * TCP–PROXY — client information is not lost and is transmitted in a separate connection header;
       * UDP–UDP — the UDP protocol is faster than TCP but less reliable;
       * HTTP–HTTP — L7 load balancing;
       * HTTPS–HTTP — L7 load balancing with encryption and SSL certificate termination on the load balancer.

    7. The default port will be automatically selected for the chosen protocol; change it if necessary. The port value will be common to all servers in the group.

    8. Open the **Servers** tab.

    9. Select the servers to add to the target group.

    10. Specify settings for each selected server:

        10.1. Select an IP address.

        10.2. Optional: change the port.

        10.3. Specify the server weight — this is a proportional measure indicating the share of requests that the server processes. If weight values are equal, the servers handle an equal number of requests. For example, if there is one server with a weight of "2" and two servers with a weight of "1" in a group, the first server will receive 50% of all requests, and the other two will receive 25% each. The maximum weight value is 256.

        10.4. Optional: to direct traffic to a server only when other servers in the group are unavailable, select the **Backup** checkbox.

    11. Open the **Algorithm** tab.

    12. Select a [request distribution algorithm](/cloud-servers/load-balancers/about-load-balancers.mdx#request-distribution-algorithms) — Round Robin or Least connections.

    13. Optional: to enable the [Sticky Sessions](/cloud-servers/load-balancers/about-load-balancers.mdx#sticky-sessions) method, select the **Sticky sessions** checkbox.

    14. Open the **Availability checks** tab.

    15. Select the type of [availability check](/cloud-servers/load-balancers/about-load-balancers.mdx#availability-checks). Once the group is created, the check type cannot be changed.

    16. If the HTTP check type is selected, specify the request parameters — method, path, and expected response codes.

    17. Specify the check interval — the interval in seconds at which the load balancer sends check requests to the servers.

    18. Specify the connection timeout — the response wait time in seconds; it must be less than the check interval.

    19. Specify the success threshold — the number of consecutive successful requests after which the server is set to working status.

    20. Specify the failure threshold — the number of consecutive unsuccessful requests after which server operation is suspended.

    21. Optional: change the target group name or leave the default one.

    22. Optional: enter a comment for the group.

    23. Click **Create target group**.
  </TabItem>

  <TabItem value="openstack">
    <TabItemLabel>
      OpenStack CLI
    </TabItemLabel>

    1. [Open the OpenStack CLI](/cloud-servers/tools/openstack-cli/).

    2. Create a target group:

       ```bash
       openstack loadbalancer pool create \
         --name <pool_name> \
         --lb-algorithm <algorithm> \
         --listener <listener_name> \
         --protocol <protocol>
       ```

       Specify:

       * `<pool_name>` — the target group name;
       * `<algorithm>` — the algorithm name: `ROUND_ROBIN` or `LEAST_CONNECTIONS`;
       * `<listener_name>` — the rule name, which can be viewed using the `openstack loadbalancer listener list`;
       * `<protocol>` — the protocol name: `TCP`, `UDP`, `HTTP`, `PROXY`;

    3. Add a server to the target group:

       ```bash
       openstack loadbalancer member create \
         --subnet-id <subnet_uuid> \
         --address <server_ip_address> \
         --protocol-port <port> \
         <pool_name>
       ```

       Specify:

       * `<subnet_uuid>` — the ID of the server's private or public subnet. The list can be viewed using the `openstack subnet list`;
       * `<server_ip_address>` — the IP address of the server from the specified subnet;
       * `<port>` — the port number;
       * `<pool_name>` — the name of the target group created in step 2.

    4. Optional: create an [availability check](/cloud-servers/load-balancers/about-load-balancers.mdx#availability-checks):

       ```bash
       openstack loadbalancer healthmonitor create \
         --delay <delay> \
         --timeout <timeout> \
         --max-retries <max_retries> \
         --max-retries-down <max_retries_down> \
         --type <type> \
         --http-method <http_method> \
         --url-path <url_path> \
         --expected-codes <codes> \
         <pool_name>
       ```

       Specify:

       * `<delay>` — the interval between checks in seconds;
       * `<timeout>` — the response wait time in seconds;
       * `<max_retries>` — the number of consecutive successful requests after which the server is set to working status;
       * `<max_retries_down>` — the number of consecutive unsuccessful requests after which server operation is suspended;
       * `<type>` — the check type: `HTTP`, `PING`, `TCP`, `TLS_HELLO`, `UDP_CONNECT`;
       * HTTP request parameters if the check type chosen is `HTTP`:

         * `--http-method <http_method>` — the check method: `GET`, `POST`, `DELETE`, `PUT`, `HEAD`, `OPTIONS`, `PATCH`, `CONNECT`, `TRACE`;
         * `--url-path <url_path>` — the request path without the domain name;
         * `--expected-codes <codes>` — expected response codes separated by commas;
       * `<pool_name>` — the target group name that you specified in step 2.
  </TabItem>
</Tabs>

<Formbricks />
