---
title: "Create a Cloud Server Flavor"
sidebar_label: "Create a Flavor"
sidebar_position: 3
description: "How to create a Flavor to create a cloud server of custom configuration"
---

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'
import {TabItemLabel} from 'docs-kit/components'
import Formbricks from '@theme/MDXComponents/Formbricks'

# Create a flavor

To create cloud servers via the OpenStack CLI and Terraform, flavors are used to define the number of vCPUs, RAM, and local disk size (optional) of the server.  Through the OpenStack API, you can create a GPU flavor. Flavors correspond to custom configurations; when creating a flavor, consider the available values of custom configurations for [lines](/cloud-servers/create/configurations.mdx#lines).

<Tabs queryString="create-flavor">
  <TabItem value="openstack-cli" default>
    <TabItemLabel>
      OpenStack CLI
    </TabItemLabel>

    The flavor will be available only for the specific project and pool for which you [have configured OpenStack API authorization](/cloud-servers/tools/openstack-cli/configure-openstack-cli.mdx#configure-openstack-in-os).

    1. [Open the OpenStack CLI](/cloud-servers/tools/openstack-cli).
    2. Create a flavor:

       ```bash
       openstack flavor create \
           --private \
           --vcpus <vcpu> \
           --ram <ram_size> \
           --disk <disk_size> \
           <flavor_name>
       ```

       Specify:

       * `<vcpu>` — number of vCPUs; ;
       * `<ram_size>` — RAM size in MB; ;
       * optional: `<disk_size>` — local disk size in GB. To create a flavor with a network volume, the value must be zero;
       * `<flavor_name>` — flavor name. Must be unique and must not match the names of previously deleted flavors. You can view the list of existing flavors using `openstack flavor list`.

       Example of creating a flavor with 1 vCPU, 1 GB RAM, and a 5 GB local disk size:

       ```bash
       openstack flavor create --private --vcpus 1 --ram 1024 --disk 5 new_flavor
       ```
  </TabItem>

  <TabItem value="terraform">
    <TabItemLabel>
      Terraform
    </TabItemLabel>

    Use the [Create a flavor](/terraform/examples/cloud-servers/create-flavor/) guide in the Terraform documentation.
  </TabItem>

  <TabItem value="openstack-api">
    <TabItemLabel>
      OpenStack API
    </TabItemLabel>

    You can only create a GPU flavor via the OpenStack API.

    1. [Get an IAM token for your account or project](/api/authorization/).
    2. In the request output, copy the `X-Subject-Token` value.
    3. Open the CLI on your local computer.
    4. Create a request to create a flavor:

       ```bash
       curl 'https://<pool>.cloud.api.selcloud.ru/compute/v2.1/flavors' \
         -H 'X-Auth-Token: <x_auth_token>' \
         -H 'Content-Type: application/json' \
         --data-raw '{"flavor":{"name":"<flavor_name>","os-flavor-access:is_public":false,"vcpus":<vcpu_amount>,"ram":<ram_size>,"disk":<disk_size>,"gpu":"<gpu_type>:<gpu_amount>"}}'
       ```

       Specify:

       * `<pool>` — [pool](/infrastructure/locations.mdx#pool), in which the flavor will be created, e.g. `ru-7`. The address (URL) depends on the region and pool, and can be viewed in the [list of URLs](/api/urls/);
       * `<x_auth_token>` — the IAM token you copied in step 2; ;
       * `<flavor_name>` — flavor name. Must be unique and must not match the names of previously deleted flavors; ;
       * `<vcpu_amount>` — number of vCPUs; ;
       * `<ram_size>` — RAM size in MB; ;
       * optional: `<disk_size>` — local disk size in GB.<br />To create a flavor with a network volume, the value must be zero; ;
       * `<gpu_type>` — GPU name, for example `T4`, `A100` (without the words `NVIDIA®`, `Tesla`). For flavors with a local disk, you can only use GPUs with local disk support. You can view the list of GPUs in the [Available GPUs](/cloud-servers/create/gpus.mdx#available-gpus) table;
       * `<gpu_amount>` — number of GPUs.

       Sample request to create a flavor with 2 vCPUs, 2 GB RAM, a bootable network volume, and an NVIDIA® Tesla T4 GPU in the ru-7a pool segment:

       ```bash
       curl 'https://ru-7.cloud.api.selcloud.ru/compute/v2.1/flavors' \
         -H 'X-Auth-Token: AbCD813261b...' \
         -H 'Content-Type: application/json' \
         --data-raw '{"flavor":{"name":"flavor-name","os-flavor-access:is_public":false,"vcpus":2,"ram":2048,"disk":0,"gpu":"T4:1"}}'
       ```
  </TabItem>
</Tabs>

<Formbricks />
