[Yandex Cloud documentation](../../index.md) > [Yandex BareMetal](../index.md) > [Step-by-step guides](index.md) > Network > Creating a private connection to cloud networks

# Creating a private connection to cloud networks

With [Yandex Cloud Interconnect](../../interconnect/index.md), you can create a [private connection](../concepts/private-network.md#private-connection-to-vpc) between BareMetal [subnets](../concepts/private-network.md#private-subnet) and Yandex Virtual Private Cloud [subnets](../../vpc/concepts/network.md#subnet).

{% note info %}

Before creating a private connection, make sure your folder contains a [VRF](../concepts/private-network.md#vrf-segment) segment with at least one routable BareMetal subnet and a routing instance with at least one [announced](../../interconnect/concepts/priv-con.md#prc-announce) private VPC subnet prefix. To [order](../tutorials/bm-vrf-and-vpc-interconnect.md#request-ri) a routing instance, please [contact](https://center.yandex.cloud/support/tickets/create) support.

{% endnote %}

To create a private connection:

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the [folder](../../resource-manager/concepts/resources-hierarchy.md#folder) where you want to create your private connection.
  1. Navigate to **BareMetal**.
  1. In the left-hand panel, select ![icon](../../_assets/console-icons/vector-square.svg) **VRF** and then select the virtual network segment you need.
  1. Under **Private connection to cloud networks**, click **Configure connection**, and in the window that opens:

      1. In the **Setup method** field, select `Enter ID` and paste the `Routing Instance` private connection ID to the **Connection ID** field.

          You can also select the `Choose from folder` option. In this case, select the `Routing Instance` you need from the list that opens.

          As a result, you will see the CIDR blocks of Virtual Private Cloud subnets that will be [advertised](../../interconnect/concepts/priv-con.md#prc-announce) over Cloud Interconnect.

          {% note warning %}
          
          To successfully configure network connectivity between BareMetal subnets and on-premise or VPC subnets, their CIDR address ranges must not match or overlap.
          
          {% endnote %}
      1. To create a private connection for the specified CIDR subnets, click **Save**.

  As a result, the VRF information page will display the newly created connection ID and its status under **Private connection to cloud networks**.

- API {#api}

  To create a private connection with cloud networks, use the [PrivateCloudConnection.Create](../api-ref/PrivateCloudConnection/create.md) REST API method or the [PrivateCloudConnectionService/Create](../api-ref/grpc/PrivateCloudConnection/create.md) gRPC API call.

  Run this query:

  ```bash
  curl -X POST \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <IAM_token>" \
    -d '{
      "routingInstanceId":"fokrf2in3c7********",
      "vrfId":"ly5uyq2gbxu2********"
      }' \
    "https://baremetal.api.cloud.yandex.net/baremetal/v1alpha/privateCloudConnections"
  ```

  Where:

  * `routingInstanceId`: [Routing instance](../../cloud-router/concepts/routing-instance.md) ID in Cloud Router.
  * `vrfId`: ID of the VRF you are connecting to the Routing Instance. To get the VRF ID, use the [VrfService.List](../api-ref/Vrf/list.md) method.

  Result:

  ```json
  {
    "done": false,
    "id": "arpas4mne3********",
    "description": "Create private cloud connection",
    "createdAt": "2024-01-01T12:00:00Z",
    "createdBy": "user-id",
    "modifiedAt": "2024-01-01T12:00:00Z",
    "metadata": {
      "privateCloudConnectionId": "kor4msi1aqq********"
    }
  }
  ```

  The operation of creating a private connection is performed asynchronously. Follow the status of the operation by the `done` field.

{% endlist %}

{% note info %}

Setting up a private connection may take up to two business days. During this period, the connection status will display as `Creating`. Once the connection is created, its status will change to `Ready`.

{% endnote %}

Private cloud netweork connections may show one of the following statuses:

* `CREATING`: Connection creation in progress.
* `READY`: Connection is up and ready to use.
* `ERROR`: Connection failure. Contact support.
* `DELETING`: Connection deletion in progress.
* `UPDATING`: Connection settings update in progress.