[Yandex Cloud documentation](../../index.md) > [Yandex Cloud Backup](../index.md) > [Getting started](index.md) > Getting started with Cloud Backup on a new VM

# Getting started with Yandex Cloud Backup on a new VM


Before you get started with Cloud Backup, make sure you have a linked [billing account](../../billing/concepts/billing-account.md) and its [status](../../billing/concepts/billing-account-statuses.md) is `ACTIVE` or `TRIAL_ACTIVE`.

In this scenario, you will create a [Linux](https://en.wikipedia.org/wiki/Linux) VM and connect it to Cloud Backup. If you do not need to create a new VM and want to use an existing VM for connecting to Cloud Backup, refer to [How to get started with Yandex Cloud Backup on an existing VM](existing-vm.md).

{% cut "The cost of VM backup resources includes:" %}

* Fee for VM [computing resources](../../compute/concepts/vm-platforms.md) and [disks](../../compute/concepts/disk.md) (see [Yandex Compute Cloud pricing](../../compute/pricing.md)).
* Fee for backed up VMs and backup retention (see [Yandex Cloud Backup pricing](../pricing.md)).

{% endcut %}

To get started with Cloud Backup:

1. [Set up your infrastructure](#deploy-infrastructure).
1. [Create a VM](#vm-create).
1. [Link your VM to a backup policy](#add-policy).

If you no longer need the resources you created, [delete them](#clear-out).

## Set up your infrastructure {#deploy-infrastructure}

1. If you do not have a cloud network yet, [create](../../vpc/operations/network-create.md) one.
1. If your [cloud network](../../vpc/concepts/network.md#network) has no subnets, [create](../../vpc/operations/subnet-create.md) one:
1. In a cloud network, [create](../../vpc/operations/security-group-create.md) a security group with the following [rules](../../vpc/concepts/security-groups.md#security-groups-rules) for outgoing traffic:

    Port range | Protocol | Destination name | CIDR blocks
    --- | --- | --- | ---
    `80` | `TCP` | `CIDR` | `213.180.193.0/24`
    `80` | `TCP` | `CIDR` | `213.180.204.0/24`
    `443` | `TCP` | `CIDR` | `84.47.172.0/24`
    `443` | `TCP` | `CIDR` | `84.201.181.0/24`
    `443` | `TCP` | `CIDR` | `178.176.128.0/24`
    `443` | `TCP` | `CIDR` | `213.180.193.0/24`
    `443` | `TCP` | `CIDR` | `213.180.204.0/24`
    `7770-7800` | `TCP` | `CIDR` | `84.47.172.0/24`
    `8443` | `TCP` | `CIDR` | `84.47.172.0/24`
    `44445` | `TCP` | `CIDR` | `51.250.1.0/24`
    
    
    
    {% note tip %}
    
    When installing the [Cloud Backup agent](../concepts/agent.md) on your VM or BareMetal server, you might need to install missing software components from the internet. To do this, add the following outgoing traffic rule to the [security group](../../vpc/concepts/security-groups.md):
    * **Port range**: `0-65535`.
    * **Protocol**: `Any`.
    * **Destination name**: `CIDR`.
    * **CIDR blocks**: `0.0.0.0/0`.
    
    Once the Cloud Backup agent is installed, you can delete this rule.
    
    To access the VM over [SSH](../../compute/operations/vm-connect/ssh.md), add the following incoming traffic rule:
    * **Port range**: `22`.
    * **Protocol**: `Any`.
    * **Destination name**: `CIDR`.
    * **CIDR blocks**: `0.0.0.0/0`.
    
    {% endnote %}

## Create a VM {#vm-create}

{% 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 a VM connected to Cloud Backup.
  1. Navigate to **Compute Cloud**.
  1. In the left-hand panel, select ![image](../../_assets/console-icons/server.svg) **Virtual machines**.
  1. Click **Create virtual machine**.
  1. Under **Boot disk image**, select an [image](../../compute/concepts/image.md) with a [supported OS](../concepts/vm-connection.md#os), e.g., [Ubuntu 20.04](https://yandex.cloud/en/marketplace/products/yc/ubuntu-20-04-lts).
  1. Under **Location**, select an [availability zone](../../overview/concepts/geo-scope.md) where your VM will reside.
  1. Under **Disks and file storages** and **Computing resources**, set the preferred VM parameters.

      The minimum VM and BareMetal server specification to install and correctly run the Cloud Backup agent is as follows:
      
      * Free disk space:
      
        * For Linux-based VMs: 2 GB.
        * For Windows-based VMs: 1.2 GB.
      
      * RAM: For backups, 1 GB of RAM is required per 1 TB of backup. The RAM requirement depends on the amount and type of data processed by the [Cloud Backup agent](../concepts/agent.md).
      
      {% note tip %}
      
      Installing a Cloud Backup agent is a resource-intensive operation. If you want to use a VM in the minimum possible configuration or, for example, a VM with a [vCPU performance level](../../compute/concepts/performance-levels.md) below 100%, we recommend increasing the VM's resources during the Cloud Backup agent installation.
      
      {% endnote %}
      
      For faster data [backup](../operations/backup-vm/create.md) and [recovery](../operations/backup-vm/recover.md), the [Cloud Backup agent](../concepts/agent.md) can consume significant amounts of RAM of the backed up resource, i.e., [virtual machine](../../compute/concepts/vm.md) or [BareMetal server](../../baremetal/concepts/servers.md). The agent can even use up all the available RAM, which in some cases may disrupt the resource's other services and make it impossible to complete the backup or recovery process.
      
      To prevent such issues, [limit](../operations/limit-agent-memory-usage.md) the amount of data the agent caches in RAM.
      
      {% note info %}
      
      Limiting the Cloud Backup agent's use of RAM may slow down the backup and recovery operations.
      
      {% endnote %}

  1. Under **Network settings**:

      1. In the **Subnet** field, select the subnet you [prepared earlier](#deploy-infrastructure).
      1. In the **Public IP address** field, select `Auto`.

          Instead of assigning a public IP address to your VM, you can associate the [subnet](../../vpc/concepts/network.md#subnet) hosting this VM with a [route table](../../vpc/concepts/routing.md#rt-vm) allowing internet access via a [NAT gateway](../../vpc/concepts/gateways.md) or a custom router.

      1. In the **Security groups** field, select the security group you [configured earlier](#deploy-infrastructure).

  1. Under **Access**, select **SSH key** and specify the VM access credentials:
  
      * In the **Login** field, enter the username.
      * In the **SSH key** field, select the SSH key saved in your [organization user](../../organization/concepts/membership.md) profile.

      If your profile has no SSH keys, click **Add key** to add a new key.
  1. Enable **Backup**, and in the **Backup policies** field, select a backup [policy](../concepts/policy.md) for Cloud Backup to use for the VM.
     
     If you do not have any backup policy, click **Create** to create one.
     
     To create a new VM with a Cloud Backup connection, your account must have the `backup.user` [role](../security/index.md#backup-user) or higher for the [folder](../../resource-manager/concepts/resources-hierarchy.md#folder) you are creating the VM in.
     
     {% note info %}
     
     If your account does not have the `backup.user` role or higher, you can connect the VM to Cloud Backup using a [service account](../../iam/concepts/users/service-accounts.md) which has that role. 
     
     To do this, expand the **Additional** section and select the service account under **Service account**. If required, [create](../../iam/operations/sa/create.md) a new service account and [assign](../../iam/operations/sa/assign-role-for-sa.md) it the `backup.user` [role](../security/index.md#backup-user).
     
     {% endnote %}
     
     {% note tip %}
     
     Installing a Cloud Backup agent is a resource-intensive operation. If you want to use a VM in the minimum possible configuration or, for example, a VM with a [vCPU performance level](../../compute/concepts/performance-levels.md) below 100%, we recommend increasing the VM's resources during the Cloud Backup agent installation.
     
     {% endnote %}
     
     For more information, see [Connecting Compute Cloud VMs and Yandex BareMetal servers to Cloud Backup](../concepts/vm-connection.md).
  1. Under **General information**, enter a name for your VM:

      * 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. Click **Create VM**.

{% endlist %}

For more information on how to create a VM, see [this guide](../../compute/operations/index.md#vm-create).

## Link your VM to a backup policy {#add-policy}

When the VM switches to the `Running` status, the Cloud Backup agent will start installing on it. This may take from 5 to 10 minutes.

Once you install the agent, the VM will be added to **Cloud Backup** in the ![machines](../../_assets/console-icons/server.svg) **Virtual machines** tab and you will be able to [associate](../operations/policy-vm/attach-and-detach-vm.md) it with a [Cloud Backup policy](../concepts/policy.md).

1. Make sure the Cloud Backup agent has been installed:
   
   {% list tabs group=instructions %}
   
   - Management console {#console}
   
     1. In the [management console](https://console.yandex.cloud), select the folder where you activated Cloud Backup.
     1. Navigate to **Compute Cloud**.
     1. Select the VM.
     1. Check that the value of the **Backup** field in the **Cloud Backup** section is `No backup policy`.
   
   {% endlist %}
1. Link your VM to a backup policy:
   
   {% list tabs group=instructions %}
   
   - Management console {#console}
   
     1. In the [management console](https://console.yandex.cloud), select the folder with the activated service and VM you need.
     1. Navigate to **Cloud Backup**.
     1. In the left-hand panel, select ![policies](../../_assets/console-icons/calendar.svg) **Backup policies**.
     1. Select one of the policies created by default. Click **Create policy** to create a new policy, if required.
     1. Under **Attached resources** on the **Virtual machines** tab, click ![plus-sign](../../_assets/console-icons/plus.svg) **Attach a VM**.
     1. In the window that opens, select the VM from the list and click **Attach**.
   
   {% endlist %}
   
   As a result, the VM will be associated with the backup policy and the system will start taking its backups according to the policy schedule.

## How to delete the resources you created {#clear-out}

To stop paying for the resources you created:
1. [Delete](../operations/backup-vm/delete.md) VM backups, if any.
1. [Delete](../operations/delete-vm.md) the VM from Cloud Backup.
1. [Delete](../../compute/operations/vm-control/vm-delete.md) the VM from Compute Cloud.

## What's next {#what-is-next}

* [Learn about the service's features](../concepts/index.md)
* [See other guides on how to use the service](../operations/index.md)

#### Useful links {#see-also}

* [Creating a disk snapshot](../../compute/operations/disk-control/create-snapshot.md)

* [How to get started with Yandex Cloud Backup on an existing VM](existing-vm.md)