[Yandex Cloud documentation](../../index.md) > [Yandex DataSphere](../index.md) > [Step-by-step guides](index.md) > Working with resources > Working with Yandex Data Processing templates

# Working with Yandex Data Processing templates

[Yandex Data Processing templates](../concepts/data-processing-template.md) enable you to preset a cluster configuration for your project, making it easier to deploy temporary clusters. You can find a list of templates on your project page under **Project resources** → ![data-proc-template](../../_assets/data-processing/data-processing.svg) **Yandex Data&nbsp;Processing**, the **Shared** tab.

To work with Yandex Data Processing clusters:

1. [In the project settings](projects/update.md), specify these parameters:

   * [Default folder](../../resource-manager/concepts/resources-hierarchy.md#folder) for integrating with other Yandex Cloud services. It will house a Yandex Data Processing cluster based on the current cloud [quotas](../../data-proc/concepts/limits.md). A fee for using the cluster will be debited from your cloud billing account.
   * [Service account](../../iam/concepts/users/service-accounts.md) with the `vpc.user` [role](../../iam/concepts/access-control/roles.md). DataSphere will use for this account to work with the Yandex Data Processing cluster network.
   * [Subnet](../../vpc/concepts/network.md#subnet) for DataSphere to communicate with the Yandex Data Processing cluster. The subnet must be in the same [availability zone](../../overview/concepts/geo-scope.md) as the community you created. Since the Yandex Data Processing cluster needs to access the internet, make sure to [configure a NAT gateway](../../vpc/operations/create-nat-gateway.md) in this subnet. After you specify a subnet, the time for computing resource allocation may increase.

1. Create a [service agent](../../iam/concepts/service-control.md#service-agent):

   1. To allow a service agent to operate in DataSphere, ask your cloud admin or owner to run the following command in the Yandex Cloud CLI:
   
      ```bash
      yc iam service-control enable datasphere --cloud-id <cloud_ID>
      ```
   
      Where `--cloud-id` is the [ID of the cloud](../../resource-manager/operations/cloud/get-id.md) you are going to use in the DataSphere community.

   1. Create a service account with the following roles:

      * `dataproc.agent` to use Yandex Data Processing clusters.
      * `dataproc.admin` to create clusters from Yandex Data Processing templates.
      * `vpc.user` to use the Yandex Data Processing cluster network.
      * `iam.serviceAccounts.user` to create resources in the folder on behalf of the service account.

   1. Under **Spark clusters** in the community settings, click **Add service account** and select the service account you created.
   
{% note warning %}

The Yandex Data Processing persistent cluster must have the `livy:livy.spark.deploy-mode : client` setting.

{% endnote %}

## Creating a Yandex Data Processing template {#create}

1. Select the project in your community or on the DataSphere [home page](https://datasphere.yandex.cloud) in the **Recent projects** tab.
1. Under **Project resources**, click ![data-proc-template](../../_assets/data-processing/data-processing.svg) **Yandex Data&nbsp;Processing**.
1. Click **Create template**.
1. In the **Template name** field, enter a name for the template. Follow these naming requirements:

    * 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**. You will see a page with detailed info on the template you created.

## Activating a Yandex Data Processing template {#activate}

1. Select the project in your community or on the DataSphere [home page](https://datasphere.yandex.cloud) in the **Recent projects** tab.
1. Under **Project resources**, click ![data-proc-template](../../_assets/data-processing/data-processing.svg) **Yandex Data&nbsp;Processing**.
1. Click ![options](../../_assets/console-icons/ellipsis.svg) next to the template you need and select **Activate**.

The system will create a cluster based on the activated Yandex Data Processing template when you run your project in the IDE.

## Sharing a Yandex Data Processing template {#share}

1. Select the project in your community or on the DataSphere [home page](https://datasphere.yandex.cloud) in the **Recent projects** tab.
1. Under **Project resources**, click ![data-proc-template](../../_assets/data-processing/data-processing.svg) **Yandex Data&nbsp;Processing**.
1. Select the template from the list.
1. Go to the **Access** tab.
1. Enable the visibility option next to the name of the community you want to share the template in.

To make a template available for use in a different project, the project admin needs to [add](projects/use-shared-resource.md) that template on the **Shared** tab.

## Editing a template {#edit}

You can only change the name of an existing template. To update the configuration, [recreate](#create) the template.

1. Select the project in your community or on the DataSphere [home page](https://datasphere.yandex.cloud) in the **Recent projects** tab.
1. Under **Project resources**, click ![data-proc-template](../../_assets/data-processing/data-processing.svg) **Yandex Data&nbsp;Processing**.
1. Select the template from the list, click ![options](../../_assets/console-icons/ellipsis.svg), and select **Edit**.
1. Edit the name and click **Save**.

## Deleting a Yandex Data Processing template {#delete}

1. Select the project in your community or on the DataSphere [home page](https://datasphere.yandex.cloud) in the **Recent projects** tab.
1. Under **Project resources**, click ![data-proc-template](../../_assets/datasphere/data-processing-template.svg) **Yandex Data&nbsp;Processing**.
1. In the list, select the template you want to delete.
1. Click ![options](../../_assets/console-icons/ellipsis.svg) and select **Delete**.
1. Click **Confirm**.

{% note warning %}

In fact, [resource deletion](../../overview/concepts/data-deletion.md) can take up to 72 hours.

{% endnote %}