Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
    • Cloud Interconnect
    • Cloud Backup
    • Cloud Registry
    • Yandex AI Studio
    • Compute Cloud
    • Object Storage
    • Managed Service for Kubernetes®
    • Yandex BareMetal
    • Smart Web Security
    • Security Deck
    • Managed Service for PostgreSQL
    • Managed Service for ClickHouse®
    • Monium
    • Cloud CDN
    • Network Load Balancer
    • Virtual Private Cloud
    • Cloud DNS
    • Application Load Balancer
    • Yandex Cloud Video
    • Stackland
    • Yandex Cloud Router
    • Yandex Managed Service for Trino
    • Managed Service for MySQL®
    • Managed Service for Valkey™
    • Managed Service for Apache Spark™
    • Yandex StoreDoc
    • Managed Service for OpenSearch
    • Managed Service for Apache Kafka®
    • Data Transfer
    • Yandex MPP Analytics Engine for PostgreSQL
    • Yandex Managed Service for Apache Airflow®
    • Data Processing
    • Yandex MetaData Hub
    • Managed Service for YDB
    • Managed Service for Sharded PostgreSQL
    • Managed Service for YTsaurus
    • Yandex WebSQL
    • DataLens
    • Yandex Search API
    • SpeechSense
    • SpeechKit
    • DataSphere
    • Vision OCR
    • Translate
    • Yandex Identity Hub
    • Key Management Service
    • Certificate Manager
    • Yandex Lockbox
    • Audit Trails
    • SmartCaptcha
    • Cloud Desktop
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • Serverless Integrations
    • IoT Core
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Yandex Query
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • 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

In this article:

  • Applying or updating a policy
  • Deleting a rule
  • Viewing a policy
  • Deleting a policy
  1. Step-by-step guides
  2. Buckets
  3. Managing access policies

Managing a bucket policy

Written by
Yandex Cloud
Improved by
Tania L.
Updated at July 31, 2026
View in Markdown
  • Applying or updating a policy
    • Deleting a rule
  • Viewing a policy
  • Deleting a policy

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

Bucket policies set permissions for operations with buckets, objects, and object groups.

For examples of bucket policies for specific use cases, see Configuration examples.

Warning

If you want to configure an access policy for a bucket and connect to it from a Apache Hive™ Metastore or Yandex Managed Service for Apache Airflow™ cluster, you will need some additional infrastructure setup. For more information, see Apache Hive™ Metastore and Managed Service for Apache Airflow™ guides.

Applying or updating a policyApplying or updating a policy

The minimum role required to apply or update a bucket policy is storage.configurer. For more information, see the role description.

Note

If the bucket already had a bucket policy configured, it will be completely overwritten once you apply the changes.

To apply or update a bucket policy:

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

  2. Navigate to Object Storage.

  3. Select the bucket to configure an access policy in.

  4. In the left-hand panel, select Security and go to the Access policy tab.

  5. Click Configure access.

  6. Enter a bucket policy ID.

  7. Set up a rule:

    1. Enter a rule ID.

    2. Configure rule settings:

      • Result: Allow or deny.

      • Selection principle: Include or exclude users.

      • User: Select all users or list specific subjects.

        To list specific subjects:

        • Select Select users.

        • Select the subjects you need from the list. To do this, place the cursor in the subject input field, then select the required user, service account, user group, system group, or public group in the form that appears. If required, use the relevant tabs in the form or the search bar to find a subject by name or email address.

          You can select multiple subjects; to do this, select them one by one.

      • Action for which you are creating the rule. You can also enable All actions.

      • Resource: Defaults to the selected bucket. To add other resources to the rule, click Add resource.

        Note

        A bucket resource does not include resources of all its objects. To make sure a bucket policy rule refers to the bucket and all the objects, specify them as separate resources, e.g., samplebucket and samplebucket/*.

    3. If required, add a condition for the rule:

      • Select Key from the list.
      • Select Operator from the list. If you want the operator to apply solely to the existing fields, select Apply if the field exists. This way, if the field is missing, the condition will be considered met.
      • Specify Value.
      • Click Add value to add another value to the condition.

      You can set multiple conditions for a rule and specify multiple keys for each condition. These conditions and their keys will be checked using the logical AND, i.e., the request must meet all the specified criteria at once.

      You can set multiple values for each condition key at the same time. These values will be checked using the logical OR, i.e., the request must match any of the specified condition key values.

  8. Add other rules and configure them as needed.

  9. Optionally, to allow access to the bucket through the management console, click Add console access rule. For more information, see Bucket access via the management console.

  10. Click Save and confirm deletion.

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 editing a bucket ACL:

    yc storage bucket update --help
    
  2. Describe your bucket policy configuration as a JSON data schema:

    {
      "Version": "2012-10-17",
      "Statement": {
        "Effect": "Allow",
        "Principal": "*",
        "Action": "s3:GetObject",
        "Resource": "arn:aws:s3:::<bucket_name>/*",
        "Condition": {
          "Bool": {
            "aws:SecureTransport": "true"
          }
        }
      }
    }
    

    Where:

    • Version: Version of the bucket policy description. This is an optional setting.
    • Statement: Bucket policy rules:
      • Effect: Deny or allow the requested action. The possible values are Allow and Deny.

      • Principal: ID of the subject requesting the permission. You can request permissions for a user, service account, or user group. This is an optional setting. The possible values are:

        • "*"
        • "CanonicalUser": "<subject_ID>"

        You can get the IDs in the following ways:

        • User.
        • Service account.
        • User group: Navigate to the Groups tab in the Cloud Center interface.
      • Action: Action to allow when the policy is triggered. The possible values are s3:GetObject, s3:PutObject, and * (if you need to apply the policy to all actions).

      • Resource: Resource to apply the rule to.

      • Condition: Condition to check. This is an optional setting.

        You can set multiple conditions for a rule and specify multiple keys for each condition. These conditions and their keys will be checked using the logical AND, i.e., the request must meet all the specified criteria at once.

        You can set multiple values for each condition key at the same time. These values will be checked using the logical OR, i.e., the request must match any of the specified condition key values.

  3. Run this command:

    yc storage bucket update \
      --name <bucket_name> \
      --policy-from-file <policy_file_path>
    

    Result:

    name: my-bucket
    folder_id: csgeoelk7fl1********
    default_storage_class: STANDARD
    versioning: VERSIONING_SUSPENDED
    max_size: "10737418240"
    policy:
        Statement:
          Action: s3:GetObject
          Condition:
            Bool:
              aws:SecureTransport: "true"
            Effect: Allow
            Principal: '*'
            Resource: arn:aws:s3:::my-bucket
          Version: "2012-10-17"
    acl: {}
    created_at: "2022-12-14T08:42:16.273717Z"
    

Note

To manage a policy using the AWS CLI, a service account needs the storage.admin role.

If you do not have the AWS CLI yet, install and configure it.

  1. Describe your bucket policy configuration as a JSON data schema:

    {
      "Version": "2012-10-17",
      "Statement": {
        "Effect": "Allow",
        "Principal": "*",
        "Action": "s3:GetObject",
        "Resource": "arn:aws:s3:::<bucket_name>/*",
        "Condition": {
          "Bool": {
            "aws:SecureTransport": "true"
          }
        }
      }
    }
    

    Where:

    • Version: Version of the bucket policy description. This is an optional setting.
    • Statement: Bucket policy rules:
      • Effect: Deny or allow the requested action. The possible values are Allow and Deny.

      • Principal: ID of the subject requesting the permission. You can request permissions for a user, service account, or user group. This is an optional setting. The possible values are:

        • "*"
        • "CanonicalUser": "<subject_ID>"

        You can get the IDs in the following ways:

        • User.
        • Service account.
        • User group: Navigate to the Groups tab in the Cloud Center interface.
      • Action: Action to allow when the policy is triggered. The possible values are s3:GetObject, s3:PutObject, and * (if you need to apply the policy to all actions).

      • Resource: Resource to apply the rule to.

      • Condition: Condition to check. This is an optional setting.

        You can set multiple conditions for a rule and specify multiple keys for each condition. These conditions and their keys will be checked using the logical AND, i.e., the request must meet all the specified criteria at once.

        You can set multiple values for each condition key at the same time. These values will be checked using the logical OR, i.e., the request must match any of the specified condition key values.

    Once the configuration is complete, save it to a file named policy.json.

  2. Run this command:

    aws s3api put-bucket-policy \
      --endpoint https://storage.yandexcloud.net \
      --bucket <bucket_name> \
      --policy file://policy.json
    

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.

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

To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), authenticate using the appropriate method.

By default, Terraform uses an IAM token for authentication in Object Storage. In addition to an IAM token, you can use a service account and static access keys for authentication to Object Storage. For more information on Terraform authentication features in Object Storage, see this provider guide.

To edit a bucket policy, you can use these resources:

  • yandex_storage_bucket_policy
  • yandex_storage_bucket (obsolete)

yandex_storage_bucket_policy

  1. Open the Terraform configuration file and specify the policy using the yandex_storage_bucket_policy resource:

    resource "yandex_storage_bucket_policy" "bpolicy" {
      bucket = "my-policy-bucket"
      policy = <<POLICY
    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Principal": "*",
          "Action": "s3:*",
          "Resource": [
            "arn:aws:s3:::my-policy-bucket/*",
            "arn:aws:s3:::my-policy-bucket"
          ]
        },
        {
          "Effect": "Deny",
          "Principal": "*",
          "Action": "s3:PutObject",
          "Resource": [
            "arn:aws:s3:::my-policy-bucket/*",
            "arn:aws:s3:::my-policy-bucket"
          ]
        }
      ]
    }
    POLICY
    }
    

    Where:

    • bucket: Bucket name. This is a required parameter.
    • policy: Policy name. This is a required parameter.

    Policy settings:

    • Version: Version of the bucket policy description. This is a required parameter. The only supported value is 2012-10-17.
    • Statement: Bucket policy rules:
      • Effect: Deny or allow the requested action. The possible values are Allow and Deny.

      • Principal: ID of the subject requesting the permission. You can request permissions for a user, service account, or user group. This is an optional setting. The possible values are:

        • "*"
        • "CanonicalUser": "<subject_ID>"

        You can get the IDs in the following ways:

        • User.
        • Service account.
        • User group: Navigate to the Groups tab in the Cloud Center interface.
      • Action: Action to allow when the policy is triggered. Examples of possible values: s3:GetObject, s3:PutObject. Use * if you need to apply the policy to all actions.

      • Resource: Resource to apply the rule to.

      • Condition: Condition to check. This is an optional setting.

        You can set multiple conditions for a rule and specify multiple keys for each condition. These conditions and their keys will be checked using the logical AND, i.e., the request must meet all the specified criteria at once.

        You can set multiple values for each condition key at the same time. These values will be checked using the logical OR, i.e., the request must match any of the specified condition key values.

    For more information on the properties of the yandex_storage_bucket_policy resource, 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 using the management console.

yandex_storage_bucket (obsolete)

  1. Open the Terraform configuration file and specify the policy in the policy parameter for the yandex_storage_bucket resource:

    resource "yandex_storage_bucket" "mybucket" {
      bucket     = "my-policy-bucket"
      policy     = <<POLICY
    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Principal": "*",
          "Action": "s3:*",
          "Resource": [
            "arn:aws:s3:::my-policy-bucket/*",
            "arn:aws:s3:::my-policy-bucket"
          ]
        },
        {
          "Effect": "Deny",
          "Principal": "*",
          "Action": "s3:PutObject",
          "Resource": [
            "arn:aws:s3:::my-policy-bucket/*",
            "arn:aws:s3:::my-policy-bucket"
          ]
        }
      ]
    }
    POLICY
    }
    

    Where:

    • bucket: Bucket name. This is a required parameter.
    • policy: Policy name. This is a required parameter.

    Policy settings:

    • Version: Version of the bucket policy description. This is a required parameter. The only supported value is 2012-10-17.
    • Statement: Bucket policy rules:
      • Effect: Deny or allow the requested action. The possible values are Allow and Deny.

      • Principal: ID of the subject requesting the permission. You can request permissions for a user, service account, or user group. This is an optional setting. The possible values are:

        • "*"
        • "CanonicalUser": "<subject_ID>"

        You can get the IDs in the following ways:

        • User.
        • Service account.
        • User group: Navigate to the Groups tab in the Cloud Center interface.
      • Action: Action to allow when the policy is triggered. Examples of possible values: s3:GetObject, s3:PutObject. Use * if you need to apply the policy to all actions.

      • Resource: Resource to apply the rule to.

      • Condition: Condition to check. This is an optional setting.

        You can set multiple conditions for a rule and specify multiple keys for each condition. These conditions and their keys will be checked using the logical AND, i.e., the request must meet all the specified criteria at once.

        You can set multiple values for each condition key at the same time. These values will be checked using the logical OR, i.e., the request must match any of the specified condition key values.

    For more information on the properties of the yandex_storage_bucket resource, 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 using the management console.

To manage a bucket policy, use the update REST API method for the Bucket resource, the BucketService/Update gRPC API call, or the PutBucketPolicy S3 API method. If the bucket already had a bucket policy configured, it will be completely overwritten once you apply the new policy.

Note

If a bucket policy with no rules is applied to the bucket, access is denied to all users. To disable request verification for a bucket policy, delete it.

Deleting a ruleDeleting a rule

To delete a rule from an access policy:

Management console
  1. In the management console, select a folder.
  2. Navigate to Object Storage.
  3. Select the bucket to configure an access policy in.
  4. In the left-hand panel, select Security and go to the Access policy tab.
  5. Click Configure access.
  6. Next to the rule, click and select Delete.

Tip

Leave at least one rule in the access policy. If a bucket is subject to a policy with no rules in it, by default all actions with the bucket will be denied to all users.

To disable access policy checks, delete the policy.

Viewing a policyViewing a policy

The minimum role required to view a bucket policy is storage.configViewer. For more information, see the role description.

To view the bucket policy applied to a bucket:

Management console
AWS CLI
API
  1. In the management console, select a folder.
  2. Navigate to Object Storage.
  3. Select the bucket from the list.
  4. In the left-hand menu, select Security and go to the Access policy tab.

Run this command:

aws --endpoint https://storage.yandexcloud.net s3api get-bucket-policy \
  --bucket <bucket_name> \
  --output text

Result:

{
  "Policy": "{\"Version\":\"2012-10-17\",\"Statement\":{\"Effect\":\"Allow\",\"Principal\":\"*\",\"Action\":\"s3:GetObject\",\"Resource\":\"arn:aws:s3:::<bucket_name>/*\",\"Condition\":{\"Bool\":{\"aws:SecureTransport\":\"true\"}}}}"
}

For more information about parameters, see the data schema description.

Use the GetBucketPolicy S3 API method.

Deleting a policyDeleting a policy

The minimum role required to delete a bucket policy is storage.configurer. For more information, see the role description.

To delete a bucket policy:

Management console
AWS CLI
Terraform
API
  1. In the management console, select a folder.
  2. Navigate to Object Storage.
  3. Select the bucket from the list.
  4. In the left-hand menu, select Security and go to the Access policy tab.
  5. Click and select Delete access policy.
  6. Click Delete and confirm deletion.

Run this command:

aws --endpoint https://storage.yandexcloud.net s3api delete-bucket-policy \
  --bucket <bucket_name>

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

To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), authenticate using the appropriate method.

By default, Terraform uses an IAM token for authentication in Object Storage. In addition to an IAM token, you can use a service account and static access keys for authentication to Object Storage. For more information on Terraform authentication features in Object Storage, see this provider guide.

You can use the yandex_storage_bucket_policy and yandex_storage_bucket resources to specify the policy (this method is deprecated).

  1. Open the Terraform configuration file describing the bucket policy.

    • If you applied a bucket policy using the yandex_storage_bucket resource:

      yandex_storage_bucket
      1. Find the parameters of the previously created bucket policy to delete in the configuration file:

        resource "yandex_storage_bucket" "b" {
          bucket = "my-policy-bucket"
          policy = <<POLICY
        {
          "Version": "2012-10-17",
          "Statement": [
            {
              "Effect": "Allow",
              "Principal": "*",
              "Action": "s3:*",
              "Resource": [
                "arn:aws:s3:::my-policy-bucket/*",
                "arn:aws:s3:::my-policy-bucket"
              ]
            },
            {
              "Effect": "Deny",
              "Principal": "*",
              "Action": "s3:PutObject",
              "Resource": [
                "arn:aws:s3:::my-policy-bucket/*",
                "arn:aws:s3:::my-policy-bucket"
              ]
            }
          ]
        }
        POLICY
        }
        
      2. Delete the policy field describing the bucket policy settings from the configuration file.

    • If you applied a bucket policy using the yandex_storage_bucket_policy resource:

      yandex_storage_bucket_policy
      1. Find the parameters of the previously created bucket policy to delete in the configuration file:

        resource "yandex_storage_bucket_policy" "bpolicy" {
          bucket = "my-policy-bucket"
          policy = <<POLICY
        {
          "Version": "2012-10-17",
          "Statement": [
          {
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:*",
            "Resource": [
              "arn:aws:s3:::my-policy-bucket/*",
              "arn:aws:s3:::my-policy-bucket"
            ]
          },
          {
            "Effect": "Deny",
            "Principal": "*",
            "Action": "s3:PutObject",
            "Resource": [
              "arn:aws:s3:::my-policy-bucket/*",
              "arn:aws:s3:::my-policy-bucket"
            ]
          }
          ]
        }
        POLICY
        }
        
      2. Delete the yandex_storage_bucket_policy section describing the bucket policy settings from the configuration file.

  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.

    This will delete the bucket policy from the specified folder. You can check the bucket policy deletion using the management console.

Use the DeleteBucketPolicy S3 API method.

Useful linksUseful links

Configuration examples

Was the article helpful?

Previous
Editing a bucket's ACL
Next
Configuring public access to a bucket
© 2026 Direct Cursus Technology L.L.C.