[Yandex Cloud documentation](../../index.md) > [Yandex Serverless Containers](../index.md) > [Step-by-step guides](index.md) > Managing a container > Scaling a container > Adding scaling settings

# Adding container scaling settings

You can set the following:

* Number of [prepared instances](../concepts/container.md#provisioned-instances).
* Maximum number of container instances per [availability zone](../../overview/concepts/geo-scope.md).
* Maximum number of simultaneous container invocations per availability zone.

Idle time of provisioned instances and container runtime on them is [charged](../pricing.md##execution-provisioned-instances) separately.

The scaling settings must be within the [quotas](../concepts/limits.md#serverless-containers-quotas).

{% note info %}

Scaling settings take effect within five minutes after they are configured.

{% endnote %}

{% list tabs group=instructions %}

- Management console {#console}

    1. In the [management console](https://console.yandex.cloud), select the folder with your container.
    1. Navigate to **Serverless Containers**.
    1. Select the container.
    1. Navigate to the **Editor** tab.
    1. Under **Settings**, specify the number of provisioned instances.
    1. Click **Create revision**.

- CLI {#cli}

    If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

    The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

    To configure scaling settings, run this command:

    ```bash
    yc serverless container revision deploy \
      --container-id <container_ID> \
      --image <Docker_image_URL> \
      --min-instances 3 \
      --zone-instances-limit 2 \
      --zone-requests-limit 1 \
      --service-account-id <service_account_ID>
    ```

    Where:
    * `--container-id`: Container ID. To find out the ID, [get](list.md) the list of containers.
    * `--image`: [Docker image](../../container-registry/concepts/docker-image.md) URL.
    * `--min-instances`: Number of provisioned instances.
    * `--zone-instances-limit`: Maximum number of container instances per availability zone.
    * `--zone-requests-limit`: Maximum number of simultaneous container invocations per availability zone.
    * `--service-account-id`: [ID of the service account](../../iam/operations/sa/get-id.md) with Docker image pull permissions.

    Result:

    ```
    done (3s)
    id: bbalbpl7k8hmn********
    container_id: bbab5i36nvda********
    created_at: "2026-04-01T13:46:38.069Z"
    image:
      image_url: cr.yandex/crpp35hht729********/ubuntu:hello
      image_digest: sha256:f6f34c6cf5f56e594e9828274592f1cc4d9383b1689057ccaf188d41********
    resources:
      memory: "134217728"
      cores: "1"
      core_fraction: "100"
    execution_timeout: 3s
    concurrency: "1"
    service_account_id: aje07l4q4vmo********
    status: ACTIVE
    provision_policy:
      min_instances: "1"
    scaling_policy:
      zone_instances_limit: "2"
      zone_requests_limit: "1"
    log_options:
      folder_id: b1gc1t4cb638********
    runtime:
      http: {}
    metadata_options: {}
    ```

    To learn more about the command, see the [CLI reference](../../cli/cli-ref/serverless/cli-ref/container/revision/deploy.md).

- Terraform {#tf}
  
    With [Terraform](https://www.terraform.io/), you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.
    
    Terraform is distributed under the [Business Source License](https://github.com/hashicorp/terraform/blob/main/LICENSE). The [Yandex Cloud provider for Terraform](https://github.com/yandex-cloud/terraform-provider-yandex) is distributed under the [MPL-2.0](https://www.mozilla.org/en-US/MPL/2.0/) license.
    
    For more information about the provider resources, see the guides on the [Terraform](https://www.terraform.io/docs/providers/yandex/index.html) website or [its mirror](../../terraform/index.md).
    
    If you do not have Terraform yet, [install it and configure the Yandex Cloud provider](../../tutorials/infrastructure-management/terraform-quickstart.md#install-terraform).
    
    
    To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), [authenticate](../../terraform/authentication.md) using the appropriate method.

    1. To set the number of prepared instances, describe the `min_instances` parameter in the configuration file.

        You can configure other scaling settings using the management console, Yandex Cloud CLI, or API.
        
        Here is an example of the configuration file structure:
        
        ```
        resource "yandex_serverless_container" "container" {
          name               = "container"
          service_account_id = "ajeh91ebakk1********"
          memory             = 128
          image {
            url = "cr.yandex/crpnj09pj62e********/ubuntu:hello"
          }
          provision_policy {
            min_instances = 2
          }
        }
        ```

        Where:
        * `name`: Container name.
        * `service_account_id`: [ID of the service account](../../iam/operations/sa/get-id.md) with Docker image pull permissions.
        * `memory`: Required memory. The default value is 128 MB.
        * `url`: [Docker image](../../container-registry/concepts/docker-image.md) URL.
        * `min_instances`: Number of provisioned instances.
       
       For more on the properties of the `yandex_serverless_container` resource, see [this provider guide](../../terraform/resources/serverless_container.md).

    1. Run a check using this command:

        ```
        terraform plan
        ```

        The terminal will display a list of resource parameters. This is a verification step: the resource will not be modified. Otherwise, Terraform will show any detected errors.

    1. Apply the configuration changes:

        ```
        terraform apply
        ```

    1. Confirm changing the resources: enter `yes` in the terminal window and press **Enter**.

- API {#api}

  To add container scaling settings, use the [deployRevision](../containers/api-ref/Container/deployRevision.md) REST API method for the [Container](../containers/api-ref/Container/index.md) resource or the [ContainerService/DeployRevision](../containers/api-ref/grpc/Container/deployRevision.md) gRPC API call.

{% endlist %}

## Useful links

* [Scaling a container](../concepts/container.md#scaling)