---
title: "Connect S3 to a 1C server cluster"
sidebar_label: "Connect storage to a 1C server cluster"
sidebar_position: 9
description: "How to connect S3 to a 1C server cluster for storing media files"
---

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'
import {TabItemLabel} from '@selectel/docux/components'
import MoreVerticalIcon from '@selectel/docux/icons/more-vertical'
import TrashIcon from '@selectel/docux/icons/trash'
import Formbricks from '@theme/MDXComponents/Formbricks'

# Connect S3 to a 1C server cluster

S3 is a service for storing and serving an unlimited volume of data.You can connect [S3](/s3/about/) to your 1C server cluster to save media files there — images and documents.This allows you to:

* reduce the number of requests to the database cluster — file action requests will be routed to the storage bucket;
* improve the reliability of media file storage — data in S3 is replicated to three independent servers in different racks;
* edit and replace media files in the bucket in the [Control panel](https://my.selectel.ru/storage/) or using [S3 tools](/s3/tools/).

## Operating principle \{#principle-of-operation}

You connect S3 to a 1C server cluster in the [Control panel](https://my.selectel.ru/ones/server), and then configure the media file storage method in the 1C configuration menu.

After that, new media files will begin to be sent to S3.Existing media files will not be automatically migrated to S3; you can migrate them after connecting.

After connecting and configuring, you can work with media files via both 1C and S3 — for example, you can create, modify, or delete them in S3, while 1C will display their current status.

S3 has a flat addressing structure — there are no folders or hierarchies in the storage, but you can create and view [simulated folders (directories](/s3/objects/manage-folder.mdx)) for easier management. The folder name is a prefix in the object name.

You cannot connect parent and child directories in the same bucket simultaneously. For example, if the `example/images` directory is connected, you cannot connect its parent directory `example` or a child directory `example/images/photos`, but you can connect the `example/documents` directory.

There are two ways to connect S3:

* [automatically](#connect-automatically) — you can connect an existing bucket or create a new one. The service user and access policies for working with the bucket will be created automatically;
* [manually](#connect-manually) — you can connect an existing bucket. You must create the service user and access policies yourself.

### Limitations and recommendations for buckets \{#bucket-limitations-and-recommendations}

Only buckets can be connected to a 1C server cluster if they use:

* [Virtual-Hosted addressing](/s3/buckets/addressing-types.mdx#virtual-hosted);
* standard [storage class](/s3/about/payment.mdx#storage-types);
* in the [project](/access-control/projects/about-projects.mdx) where the 1C server cluster is located.

For optimal performance, we recommend choosing buckets that use:

* with a private type;
* in the [region and pool](/infrastructure/locations.mdx) where the 1C server cluster is located.

## Cost \{#price}

Storage of files in a bucket is charged according to the [S3 pricing and payment model](/s3/about/payment.mdx).

When a 1C server cluster is deleted, files in the connected buckets are not deleted and continue to be billed — to stop billing, [delete the buckets](/s3/buckets/delete-bucket.mdx).

## Connect a bucket to a cluster automatically \{#connect-automatically}

When connecting a bucket, the following will be created and configured by default:

* service user `GO1C_SERVICE_USER`;
* access policy for the service user `GO1C_POLICY`;
* access policy for the current user `ALL_OTHER`.

A bucket can be connected automatically by the [Account Owner](/access-control/user-types.mdx#account-owner) or users with combinations of the [`member`](/access-control/role-reference.mdx#member) and [`iam.admin`](/access-control/role-reference.mdx#iam-admin) roles.

A bucket can only be connected to 1C server clusters with the `ACTIVE` status.

:::warning

If you modify or delete a service user or access policies, the connection to the 1C server cluster may be lost, but the connection status in the Control panel will not change.

:::

<Tabs queryString="connect-automatically">
  <TabItem value="new" default>
    <TabItemLabel>
      New bucket
    </TabItemLabel>

    1. In the [Control panel](https://my.selectel.ru/ones/server), from the top menu, click **Products** and select **1C Managed Cloud**.
    2. Go to the **1C Server Clusters** section.
    3. Open the cluster page → **Storage** tab.
    4. Click **Connect**.
    5. Select the connection type — Automatically.
    6. In the **Region** and **Pool** fields, select the [region and pool](/infrastructure/locations.mdx) where the bucket will be created. We recommend creating the bucket in the same region and pool as the 1C server cluster.
    7. In the **Bucket** field, select **New S3 bucket**. This will create a private bucket with Virtual-Hosted addressing and a standard storage class.
    8. In the **Bucket name** field, specify a name for the new bucket. For S3 API compatibility, the bucket name must be unique within S3 and comply with Amazon S3 bucket naming rules; for more details, see the [Bucket naming rules](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html) in the Amazon documentation.
    9. In the **Prefix** field, specify a prefix for the simulated folder (directory) where media files will be stored.

       To create a new folder, enter its name according to the Amazon S3 bucket naming rules. The folder will be created automatically.

       If media files will be stored in the root of the bucket, leave the field blank.
    10. Click **Create connection**.
  </TabItem>

  <TabItem value="existing">
    <TabItemLabel>
      Existing bucket
    </TabItemLabel>

    1. Ensure the bucket complies with the [limitations and recommendations for buckets](#bucket-limitations-and-recommendations).
    2. In the [Control panel](https://my.selectel.ru/ones/server), from the top menu, click **Products** and select **1C Managed Cloud**.
    3. Go to the **1C Server Clusters** section.
    4. Open the cluster page → **Storage** tab.
    5. Click **Connect**.
    6. Select the connection type — Automatically.
    7. In the **Region** and **Pool** fields, select the [region and pool](/infrastructure/locations.mdx) where the bucket is located.
    8. In the **Bucket** field, select a bucket from the list.
    9. In the **Prefix** field, specify a prefix for the simulated folder (directory) where media files will be stored.

       To create a new folder, enter its name according to the [bucket naming rules](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html) for Amazon S3. The folder will be created automatically.

       If media files will be stored in the root of the bucket, leave the field blank.
    10. Click **Create connection**.
  </TabItem>
</Tabs>

## Connect a bucket to a cluster manually \{#connect-manually}

A bucket can only be connected to 1C server clusters with the `ACTIVE` status.

:::warning

If you modify or delete a service user or access policies, the connection to the 1C server cluster may be lost, but the connection status in the Control panel will not change.

:::

1. [Prepare the bucket for connection](#set-up-bucket).
2. [Connect the bucket](#connect-bucket).

### 1. Prepare the bucket for connection \{#set-up-bucket}

<Tabs queryString="set-up-bucket">
  <TabItem value="new" default>
    <TabItemLabel>
      Create a new bucket
    </TabItemLabel>

    1. Ensure you are in the [project](/access-control/projects/about-projects.mdx) where the 1C server cluster is located.

    2. [Create a service user](/access-control/manage/add-user.mdx#add-service-user) with the following settings:

       * scope — **Projects**;
       * a project has been added where the bucket will be created;
       * role — [`s3.user`](/access-control/role-reference.mdx#s3-user).

    3. [Create a bucket](/s3/buckets/create-bucket.mdx) in object storage. Observe [limitations and recommendations for buckets](#bucket-limitations-and-recommendations).

    4. Go to the [Object Storage](https://my.selectel.ru/storage/) → **Buckets** section.

    5. Open the page of the created bucket → **Bucket Policy** tab.

    6. Click **Create Bucket Policy**.

    7. [Add a rule](/s3/buckets/bucket-policy/create-policy.mdx#add-rule) for the service account:

       * in the **Access** field, select **Allow**;
       * in the **Users** field, select **Authorized** and add the service user you created in step 2;
       * in the **Actions** field, select **Editor**.

    8. [Add a rule](/s3/buckets/bucket-policy/create-policy.mdx#add-rule) for [users](/access-control/user-types.mdx#users):

       * in the **Access** field, select **Allow**;
       * in the **Users** field, select **Authorized** and add the user who will connect the storage to the 1C cluster;
       * in the **Actions** field, select **All**.

    9. Click **Save**.

    10. [Issue S3 keys](/access-control/manage/edit-user-data-or-role.mdx#manage-s3-keys)) for the service user.
  </TabItem>

  <TabItem value="existing">
    <TabItemLabel>
      Prepare an existing bucket
    </TabItemLabel>

    1. Ensure the bucket complies with the [limitations and recommendations for buckets](#bucket-limitations-and-recommendations).

    2. Ensure you are in the [project](/access-control/projects/about-projects.mdx) where the 1C server cluster and object storage bucket are located.

    3. [Create a service user](/access-control/manage/add-user.mdx#add-service-user) with the following settings:

       * scope — **Projects**;
       * a project has been added where the bucket will be created;
       * role — [`s3.user`](/access-control/role-reference.mdx#s3-user).

    4. Go to the [Object Storage](https://my.selectel.ru/storage/) → **Buckets** section.

    5. Open the page of the created bucket → **Bucket Policy** tab.

    6. Click **Create Bucket Policy**.

    7. [Add a rule](/s3/buckets/bucket-policy/create-policy.mdx#add-rule) for the service account:

       * in the **Access** field, select **Allow**;
       * in the **Users** field, select **Authorized** and add the service user you created in step 3;
       * in the **Actions** field, select **Editor**.

    8. [Add a rule](/s3/buckets/bucket-policy/create-policy.mdx#add-rule) for the user:

       * in the **Access** field, select **Allow**;
       * in the **Users** field, select **Authorized** and add the user who will connect the storage to the 1C cluster;
       * in the **Actions** field, select **All**.

    9. Click **Save**.

    10. [Issue S3 keys](/access-control/manage/edit-user-data-or-role.mdx#manage-s3-keys)) for the service user.
  </TabItem>
</Tabs>

### 2. Connect the bucket \{#connect-bucket}

1. In the [Control panel](https://my.selectel.ru/ones/server), from the top menu, click **Products** and select **1C Managed Cloud**.
2. Go to the **1C Server Clusters** section.
3. Open the cluster page → **Storage** tab.
4. Click **Connect**.
5. Select the connection type — Manually.
6. In the **Region** and **Pool** fields, select the region and pool where the [bucket](#set-up-bucket) is located.
7. In the **Bucket** field, select the bucket, which you prepared earlier.
8. In the **Prefix** field, specify a prefix for the simulated folder (directory) where media files will be stored.

   To create a new folder, enter its name according to the [bucket naming rules](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html) for Amazon S3. The folder will be created automatically.

   If media files will be stored in the root of the bucket, leave the field blank.
9. In the **S3 keys** block, specify the **Access key** and **Secret key** for the service user that you created when [preparing the bucket](#set-up-bucket).
10. Click **Create connection**.

## Disconnect the bucket \{#disconnect-bucket}

You can only disconnect a bucket from a 1C server cluster that is in the `ACTIVE` status.When disconnecting a bucket from the cluster, the service user S3 key and the access policy rule for the service user that were created for this bucket will be deleted.

1. In the [Control panel](https://my.selectel.ru/ones/server), from the top menu, click **Products** and select **1C Managed Cloud**.
2. Go to the **1C Server Clusters** section.
3. Open the cluster page → **Storage** tab.
4. In the bucket line, click <TrashIcon />.
5. Enter the name of the bucket to confirm deletion.
6. Click **Disconnect**. If the bucket is no longer needed, [delete it](/s3/buckets/delete-bucket.mdx).

<Formbricks />
