Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Object Storage
    • All guides
      • Creating a bucket
      • Deleting a bucket
      • Limiting the maximum size of a bucket
      • Encrypting a bucket
      • Managing object lifecycles
      • Managing CORS configurations
      • Configuring access permissions using IAM
      • Editing a bucket's ACL
      • Managing access policies
      • Configuring public access to a bucket
      • Disabling access with static keys
      • Accessing a bucket using Security Token Service
      • Accessing a bucket with an ephemeral access key
      • Accessing a bucket using a service connection from VPC
      • Managing bucket versioning
      • Enabling logging
      • Managing object locks
      • Managing object metadata export
      • Managing bucket labels
      • Getting a list of buckets
      • Getting bucket information and statistics
      • Viewing bucket metrics
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Bucket logs
  • Release notes
  • FAQ
  1. Step-by-step guides
  2. Buckets
  3. Limiting the maximum size of a bucket

Limiting the maximum size of a bucket

Written by
Yandex Cloud
Improved by
Tania L.
Updated at May 6, 2026

Object Storage enables limiting the maximum bucket size.

For example, if your service enables users to upload objects to Object Storage, then, by limiting the maximum size, you can better manage user actions and avoid unnecessary costs.

Management console
Yandex Cloud CLI
Terraform
API
  1. In the management console, select any folder.

  2. Navigate to Object Storage.

  3. Select the bucket to limit the maximum size for.

  4. In the left-hand panel, select Settings.

  5. Select the General tab.

  6. Set the value of the Max size field.

    If the value is 0, the size is not limited. It is similar to the enabled No limit option.

  7. Click Save.

If you do not have the Yandex Cloud CLI yet, install and initialize it.

The folder used by default is the one specified when creating 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.

  1. See the description of the CLI command for updating a bucket:

    yc storage bucket update --help
    
  2. Get a list of buckets in the default folder:

    yc storage bucket list
    

    Result:

    +------------------+----------------------+-------------+-----------------------+---------------------+
    |       NAME       |      FOLDER ID       |  MAX SIZE   | DEFAULT STORAGE CLASS |     CREATED AT      |
    +------------------+----------------------+-------------+-----------------------+---------------------+
    | first-bucket     | b1gmit33ngp6******** | 53687091200 | STANDARD              | 2022-12-16 13:58:18 |
    +------------------+----------------------+-------------+-----------------------+---------------------+
    
  3. Save the name (from the NAME column) of the bucket whose size you want to limit.

  4. Limit the maximum size of the bucket:

    yc storage bucket update \
      --name <bucket_name> \
      --max-size <maximum_bucket_size>
    

    Where:

    • --name: Name of the bucket whose size you want to limit.
    • --max-size: Maximum bucket size, in bytes (0 for unlimited).

    Result:

    name: first-bucket
    older_id: b1gmit33ngp6********
    default_storage_class: STANDARD
    versioning: VERSIONING_DISABLED
    max_size: "26843545600"
    acl: {}
    created_at: "2022-12-16T13:58:18.933814Z"
    

Note

If you access Object Storage via Terraform under a service account, assign to the service account the relevant role, e.g., storage.admin, for the folder you are going to create the resources in.

With Terraform, 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. The Yandex Cloud provider for Terraform is distributed under the MPL-2.0 license.

For more information about the provider resources, see the relevant documentation on the Terraform website or its mirror.

If you do not have Terraform yet, install it and configure the Yandex Cloud provider.

To limit the maximum bucket size:

  1. Open the Terraform configuration file and add the max_size parameter to the bucket description:

    ...
    resource "yandex_storage_bucket" "test" {
      access_key = "<static_key_ID>"
      secret_key = "<secret_key>"
      bucket     = "tf-test-bucket"
      max_size   = 1048576
    }
    ...
    

    Where:

    • access_key: Static access key ID.

      Note

      In addition to static access keys, you can use an IAM token for authentication in Object Storage. For more details, see Creating a bucket and the relevant provider documentation.

    • secret_key: Secret access key value.

    • max_size: Maximum bucket size, in bytes.

    For more information about the yandex_storage_bucket properties in Terraform, see this provider guide.

  2. Apply the changes:

    1. In the terminal, navigate to the configuration file directory.

    2. Make sure the configuration is correct using this command:

      terraform validate
      

      If the configuration is valid, you will get this message:

      Success! The configuration is valid.
      
    3. Run this command:

      terraform plan
      

      You will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.

    4. Apply the configuration changes:

      terraform apply
      
    5. Type yes and press Enter to confirm the changes.

    You can check the update in the management console.

To limit the maximum bucket size, use the update REST API method for the Bucket resource or the BucketService/Update gRPC API call.

Was the article helpful?

Previous
Deleting a bucket
Next
Encrypting a bucket
© 2026 Direct Cursus Technology L.L.C.