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
    • Start testing with double trial credits
    • 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
  1. Step-by-step tutorials
  2. Buckets
  3. Deleting a bucket

Deleting a bucket

Written by
Yandex Cloud
Improved by
Tania L.
Updated at May 5, 2025

Warning

You can only delete an empty bucket. In the management console, the information about the number of objects in the bucket is updated with a few minutes' delay.

To delete a bucket that stores the logs of another bucket, go to the source bucket settings to disable logging or select a different target bucket for storing logs.

Management console
Yandex Cloud CLI
AWS CLI
Terraform
API
  1. In the management console, select Object Storage from the list of services.
  2. Select the bucket in question, click , and select Delete.
  3. In the window that opens, click Delete.

Note

It is more convenient to work with multiple buckets using the CyberDuck and WinSCP file browsers or the AWS CLI.

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 deleting a bucket:

    yc storage bucket delete --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 you are going to delete.

  4. Delete the bucket:

    yc storage bucket delete --name <bucket_name>
    

    Where --name is the name of the bucket to delete.

    Note

    It is more convenient to work with multiple buckets using the CyberDuck and WinSCP file browsers or the AWS CLI.

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

In the terminal, run the aws s3api delete-bucket command:

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

Where:

  • --bucket: Name of the bucket to delete.
  • --endpoint-url: Object Storage endpoint.

Alternatively, you can use the aws s3 rb command:

aws --endpoint-url=https://storage.yandexcloud.net \
  s3 rb s3://<bucket_name>

To simultaneously delete multiple buckets, run this command:

Note

You can authorize in the Amazon S3 HTTP API and tools that support it using static keys obtained for the service account.

You can only view the list of buckets in the folder in which your service account was created.

  • Bash:

    aws s3api list-buckets \
      --endpoint-url=https://storage.yandexcloud.net \
      --query '<query>' \
      --output text | xargs -I {} aws s3api delete-bucket --endpoint-url=https://storage.yandexcloud.net --bucket {}
    

    Where --query is the query in JMESPath format.

    Here is an example of a command that deletes all buckets whose names start with samplebucket:

    aws s3api list-buckets \
      --endpoint-url=https://storage.yandexcloud.net \
      --query 'Buckets[?starts_with(Name, `samplebucket`) == `true`].[Name]' \
      --output text | xargs -I {} aws s3api delete-bucket --endpoint-url=https://storage.yandexcloud.net --bucket {}
    
  • PowerShell:

    Foreach($x in (aws s3api list-buckets `
      --endpoint-url=https://storage.yandexcloud.net `
      --query '<query>' `
      --output text)) `
      {aws s3api delete-bucket `
      --endpoint-url=https://storage.yandexcloud.net `
      --bucket $x}
    

    Where --query is the query in JMESPath format.

    Here is an example of a command that deletes all buckets whose names start with samplebucket:

    Foreach($x in (aws s3api list-buckets `
      --endpoint-url=https://storage.yandexcloud.net `
      --query 'Buckets[?starts_with(Name, `samplebucket`) == `true`].[Name]' `
      --output text)) `
      {aws s3api delete-bucket `
      --endpoint-url=https://storage.yandexcloud.net `
      --bucket $x}
    

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 delete a bucket created with Terraform:

  1. Open the Terraform configuration file and delete the section with the bucket description.

    Example of a bucket description in Terraform configuration
    ...
    resource "yandex_storage_bucket" "test" {
      access_key = "YCAJEX9Aw2ge********-w-lJ"
      secret_key = "YCONxG7rSdz********_NRy5VbKzKlqZ********"
      bucket     = "<bucket_name>"
    }
    ...
    
  2. In the command line, go to the directory with the Terraform configuration file.

  3. Check the configuration using this command:

    terraform validate
    

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

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

    terraform plan
    

    The terminal will display a list of resources with their parameters. No changes will be made at this step. If the configuration contains any errors, Terraform will point them out.

  5. Apply the configuration changes:

    terraform apply
    
  6. Confirm the changes: type yes into the terminal and press Enter.

    You can check the update using the management console.

To delete a bucket, use the delete REST API method for the Bucket resource, the BucketService/Delete gRPC API call, or the deleteBucket S3 API method.

Note

It is more convenient to work with multiple buckets using the CyberDuck and WinSCP file browsers or the AWS CLI.

Was the article helpful?

Previous
Creating a bucket
Next
Limiting the maximum size of a bucket
© 2025 Direct Cursus Technology L.L.C.