Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Object Storage
    • All tutorials
      • 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
      • Accessing a bucket using Security Token Service
      • Accessing a bucket using a service connection from VPC
      • Managing bucket versioning
      • Enabling logging
      • Managing object locks
      • Managing bucket labels
      • Getting bucket information and statistics
      • Viewing bucket metrics
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Bucket logs
  • Release notes
  • FAQ

In this article:

  • Enabling public access
  • Disabling public access
  1. Step-by-step tutorials
  2. Buckets
  3. Configuring public access to a bucket

Configuring public access to a bucket

Written by
Yandex Cloud
Improved by
Tania L.
Updated at May 5, 2025
  • Enabling public access
  • Disabling public access

Object Storage incorporates several access management mechanisms. To learn how these mechanisms interact, see Access management methods in Object Storage: Overview.

By default, bucket access is restricted. You can enable public access:

  • To read objects in a bucket.
  • To view the list of objects in a bucket.
  • To read settings:
    • CORS
    • Static website hosting
    • Object lifecycles

Public access to each operation is granted separately. This means, if you have granted only read access to your objects, anonymous users cannot get the list of objects and bucket settings.

Enabling public accessEnabling public access

Warning

Public access is granted to an unlimited number of anonymous users. Use it only when other access grant mechanisms are not available.

Management console
Yandex Cloud CLI
Terraform
API
  1. In the management console, select Object Storage from the list of services and go to the bucket you want to configure public access for.
  2. In the left-hand panel, select Settings.
  3. Select the General tab.
  4. Enable public access for the operation types you need.
  5. Click Save.

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

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

  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 to which you want to enable public access.

  4. Enable public access to bucket operations:

    yc storage bucket update \
      --name <bucket_name> \
      --public-read \
      --public-list \
      --public-config-read
    

    Where:

    • --name: Name of the bucket to which you need to enable public access.
    • --public-read: Flag to enable public read access to bucket objects.
    • --public-list: Flag to enable public view access to the list of bucket objects.
    • --public-config-read: Flag to enable public read access to the bucket configuration.

    name: This is a required parameter. Other parameters are optional. By default, public access to the bucket is disabled.

    Result:

    name: first-bucket
    folder_id: b1gmit33ngp6********
    anonymous_access_flags:
      read: true
      list: true
      config_read: true
    default_storage_class: STANDARD
    versioning: VERSIONING_DISABLED
    max_size: "53687091200"
    acl: {}
    created_at: "2022-12-16T13:58:18.933814Z"
    

Note

Terraform uses a service account to interact with Object Storage. Assign to the service account the required role, e.g., storage.admin, for the folder where you are going to create resources.

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 documentation on the Terraform website or mirror website.

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

To open public access to bucket operations:

  1. Open the Terraform configuration file and add the anonymous_access_flags section to the bucket description.

    resource "yandex_storage_bucket" "log_bucket" {
      access_key = "<static_key_ID>"
      secret_key = "<secret_key>"
      bucket     = "<bucket_name>"
    
      anonymous_access_flags {
        read        = true
        list        = true
        config_read = true
      }
    }
    

    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.

    • bucket: Name of the bucket to which you need to enable public access.

    • anonymous_access_flags: Public access parameters:

      • read: Public read access to bucket objects.
      • list: Public access to the list of bucket objects.
      • config_read: Public read access to the bucket configuration.

    For more information about the yandex_storage_bucket resource parameters in Terraform, see this TF provider article.

  2. Make sure the configuration files are correct.

    1. In the command line, go to the directory where you created the configuration file.

    2. Run a check using this command:

      terraform plan
      

    If you described the configuration correctly, the terminal will display a list of the resources being created and their parameters. If the configuration contains any errors, Terraform will point them out.

  3. Deploy the cloud resources.

    1. If the configuration does not contain any errors, run this command:

      terraform apply
      
    2. Confirm creating the resources: type yes in the terminal and press Enter.

      This will create all the resources you need in the specified folder. You can check the new resources and their settings using the management console.

To open public access to bucket operations, use the update REST API method for the Bucket resource or the BucketService/Update gRPC API call.

Note

You will not be able to open public access if a restrictive access policy is configured for the bucket.

Disabling public accessDisabling public access

Management console
Yandex Cloud CLI
Terraform
API
  1. In the management console, select Object Storage from the list of services and go to the bucket you want to disable public access for.
  2. In the left-hand panel, select Settings.
  3. Select the General tab.
  4. Enable restricted access for the operation types you need.
  5. Click Save.

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

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

  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 to which you want to disable public access.

  4. Disable public access to bucket operations:

    yc storage bucket update \
      --name <bucket_name> \
      --public-read=false \
      --public-list=false \
      --public-config-read=false
    

    Where:

    • --name: Name of the bucket to which you need to disable public access.
    • --public-read: Flag to manage public read access to bucket objects. To disable public access, set it to false.
    • --public-list: Flag to manage public view access to the list of bucket objects. To disable public access, set it to false.
    • --public-config-read: Flag to manage public read access to the bucket configuration. To disable public access, set it to false.

    name: This is a required parameter. Other parameters are optional. By default, public access to the bucket is disabled.

    Result:

    name: first-bucket
    folder_id: b1gmit33ngp6********
    anonymous_access_flags:
      read: false
      list: false
      config_read: false
    default_storage_class: STANDARD
    versioning: VERSIONING_DISABLED
    max_size: "53687091200"
    acl: {}
    created_at: "2022-12-16T13:58:18.933814Z"
    

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 documentation on the Terraform website or mirror website.

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

To disable public access to bucket operations:

  1. Open the Terraform configuration file and add the anonymous_access_flags section to the bucket description fragment.

    resource "yandex_storage_bucket" "log_bucket" {
      access_key = "<static_key_ID>"
      secret_key = "<secret_key>"
      bucket     = "<bucket_name>"
    
      anonymous_access_flags {
        read        = false
        list        = false
        config_read = false
      }
    }
    

    Where:

    • access_key: Static access key ID.
    • secret_key: Secret access key value.
    • bucket: Name of the bucket to which you need to disable public access.
    • anonymous_access_flags: Public access parameters:
      • read: Public read access to bucket objects.
      • list: Public access to the list of bucket objects.
      • config_read: Public read access to the bucket configuration.

    For more information about the yandex_storage_bucket resource parameters in Terraform, see this TF provider article.

  2. Make sure the configuration files are correct.

    1. In the command line, go to the directory where you created the configuration file.

    2. Run a check using this command:

      terraform plan
      

    If you described the configuration correctly, the terminal will display a list of the resources being created and their parameters. If the configuration contains any errors, Terraform will point them out.

  3. Deploy the cloud resources.

    1. If the configuration does not contain any errors, run this command:

      terraform apply
      
    2. Confirm creating the resources: type yes in the terminal and press Enter.

      This will create all the resources you need in the specified folder. You can check the new resources and their settings using the management console.

To disable public access to bucket operations, use the update REST API method for the Bucket resource or the BucketService/Update gRPC API call.

When disabling public access to your bucket, make sure the All users public group has no viewer, storage.viewer, or higher role assigned for the folder or bucket. Otherwise, the bucket will still be publicly accessible.

Was the article helpful?

Previous
Managing access policies
Next
Accessing a bucket using Security Token Service
© 2025 Direct Cursus Technology L.L.C.