[Yandex Cloud documentation](../../../index.md) > [Yandex Cloud Backup](../../index.md) > [Tutorials](../index.md) > Associating a backup policy with a VM automatically > Overview

# Associating a Yandex Cloud Backup policy to a VM automatically

You can create a Yandex Compute Cloud [virtual machine](../../../compute/concepts/vm.md) with an automatically linked [backup policy](../../concepts/policy.md) based on a [supported Cloud Backup image](../../concepts/vm-connection.md#os). 

To do this, you need to provide the [Cloud Backup](../../concepts/agent.md) agent installation script and the policy ID in the VM [metadata](../../../compute/concepts/vm-metadata.md). The system automatically associates the specified policy with the VM after the VM and the Cloud Backup agent are up and running.

You can create an infrastructure to automatically associate backup policies with VMs using the following tools:

* [Yandex Cloud management console, CLI, and API](console.md): Use one of these methods to create your infrastructure step by step.
* [Terraform](terraform.md): Streamline creating and managing your resources with the _infrastructure as code_ (IaC) approach. Download a Terraform configuration example from the GitHub repository and then deploy your infrastructure using the [Yandex Cloud Terraform provider](../../../terraform/index.md).