[Yandex Cloud documentation](../../index.md) > [Yandex Virtual Private Cloud](../index.md) > [Step-by-step guides](index.md) > Cloud network > Creating a cloud network

# Creating a cloud network

In addition to the cloud network in the default folder, you can create cloud networks in other folders.

{% list tabs group=instructions %}

- Management console {#console}

  To create a [cloud network](../concepts/network.md):
  1. In the [management console](https://console.yandex.cloud), select the folder where you need to create a cloud network.
  1. Navigate to **Virtual Private Cloud**.
  1. In the top-right corner, click **Create network**.
  1. In the **Name** field, enter a name for the network. The naming requirements are as follows:

      * Length: between 3 and 63 characters.
      * It can only contain lowercase Latin letters, numbers, and hyphens.
      * It must start with a letter and cannot end with a hyphen.
  
  1. (Optional) In the **Description** field, add a network description.
  1. The default option is **Create subnets**. If you want to [create](subnet-create.md) subnets later, disable this option.
  1. Click **Create network**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  To create a [cloud network](../concepts/network.md):
  1. View the description of the CLI command for creating a cloud network:

      ```
      yc vpc network create --help
      ```

  1. Create a cloud network in the default folder:

      ```
      yc vpc network create \
        --name test-network-1 \
        --description "My test network"
      ```

      The `--name` and `--description` parameters are optional: you can create a network without any name and description and access it by ID.

      The network naming requirements are as follows:

      * Length: between 3 and 63 characters.
      * It can only contain lowercase Latin letters, numbers, and hyphens.
      * It must start with a letter and cannot end with a hyphen.

  1. Get a list of all cloud networks in the default folder:

      ```
      yc vpc network list
      ```

      Result:
      ```
      +----------------------+----------------+
      |          ID          |      NAME      |
      +----------------------+----------------+
      | enpiuvhhd4t8******** | test-network-1 |
      | enplom7a98s1******** | default        |
      +----------------------+----------------+
      ```

      Get the same list with more details in YAML format:

      ```
      yc vpc network list --format yaml
      ```

      Result:
      ```
      - id: enpiuvhhd4t8********
        folder_id: b1g6ci08ma55********
        created_at: "2018-10-23T11:12:51Z"
        name: test-network-1
        description: My first network
      - id: enplom7a98s1********
        folder_id: b1g6ci08ma55********
        created_at: "2018-09-24T08:23:00Z"
        name: default
        description: Auto-created default network
      ```

- Terraform {#tf}

  With [Terraform](https://www.terraform.io/), you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.
  
  Terraform is distributed under the [Business Source License](https://github.com/hashicorp/terraform/blob/main/LICENSE). The [Yandex Cloud provider for Terraform](https://github.com/yandex-cloud/terraform-provider-yandex) is distributed under the [MPL-2.0](https://www.mozilla.org/en-US/MPL/2.0/) license.
  
  For more information about the provider resources, see the relevant documentation on the [Terraform](https://www.terraform.io/docs/providers/yandex/index.html) website or [its mirror](../../terraform/index.md).

  If you do not have Terraform yet, [install it and configure the Yandex Cloud provider](../../tutorials/infrastructure-management/terraform-quickstart.md#install-terraform).
  
  
  To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), [authenticate](../../terraform/authentication.md) using the appropriate method.

  1. In the configuration file, describe the parameters of your [cloud network](../concepts/network.md):

     * `name`: Name of the cloud network. The naming requirements are as follows:

        * Length: between 3 and 63 characters.
        * It can only contain lowercase Latin letters, numbers, and hyphens.
        * It must start with a letter and cannot end with a hyphen.

     * `description`: Cloud network description.
     * `labels`: Cloud network [labels](../../resource-manager/concepts/labels.md). Specify a key-value pair.

     Here is an example of the configuration file structure:

     ```hcl
     resource "yandex_vpc_network" "default" {
       name        = "<network_name>"
	   description = "<network_description>"
       labels = {
         tf-label    = "tf-label-value"
         empty-label = ""
       }
     }
     ```

     For more information about the `vpc_network` resource parameters in Terraform, see the [relevant provider documentation](../../terraform/resources/vpc_network.md).

  1. Make sure the configuration files are correct.

     1. In the terminal, navigate to the directory where you created your configuration file.
     1. Run a check using this command:

        ```
        terraform plan
        ```

     If the configuration is correct, the terminal will display a list of the resources and their settings. Otherwise, Terraform will show any detected errors. 

  1. Deploy the cloud resources.

     1. If the configuration is correct, run this command:

        ```
        terraform apply
        ```

     1. Confirm creating the resources by typing `yes` and pressing **Enter**.

        This will create all the resources you need in the specified folder. You can check the new resources and their settings using the [management console](https://console.yandex.cloud) or these [CLI](../../cli/quickstart.md) commands:

        ```
        yc vpc network list
        ```

- API {#api}

  To create a [cloud network](../concepts/network.md), use the [create](../api-ref/Network/create.md) REST API method for the [Network](../api-ref/Network/index.md) resource or the [NetworkService/Create](../api-ref/grpc/Network/create.md) gRPC API call, and provide the following in the request:

    * ID of the folder the network will reside in, in the `folderId` parameter.
    * Name of the new network in the `name` parameter. The name must be 3 to 63 characters long, the last character cannot be a hyphen.
    * New network description in the `description` parameter. The description may be up to 256 characters long.

  The `name` and `description` parameters are optional: you can create a network without any name and description and access it by ID.

  To learn how to find out the folder ID, see [Getting the folder ID](../../resource-manager/operations/folder/get-id.md).

{% endlist %}

## Examples {#examples}

Create a cloud network with a name and description in the selected folder:

{% list tabs group=instructions %}

- CLI {#cli}

  ```
  yc vpc network create --name test-network-1 \
    --description "My test network" \
    --folder-id b1gnbfd11bq5********
  ```

- Terraform {#tf}

  1. In the configuration file, describe the parameters of the cloud network to create:

     ```hcl
     resource "yandex_vpc_network" "default" {
       name        = "network-1"
	   description = "My first network"
     }
     ```

     For more information about resource properties in Terraform, see the [relevant Terraform documentation](../../terraform/resources/vpc_network.md).

  1. Make sure the configuration files are correct.

     1. In the terminal, navigate to the directory where you created your configuration file.
     1. Run a check using this command:

        ```
        terraform plan
        ```

     If the configuration is correct, the terminal will display a list of the resources and their settings. Otherwise, Terraform will show any detected errors. 

  1. Deploy the cloud resources.

     1. If the configuration is correct, run this command:

        ```
        terraform apply
        ```

     1. Confirm creating the resources by typing `yes` and pressing **Enter**.

        This will create all the resources you need in the specified folder. You can check the new resources and their settings using the [management console](https://console.yandex.cloud) or these [CLI](../../cli/quickstart.md) commands:

        ```
        yc vpc network list
        ```

{% endlist %}