> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nebius.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to manage Object Storage buckets

In Object Storage, files are stored in containers called *buckets*. You can create, modify, delete, or restore them.

## Prerequisites

If you use the web console, you don't need to complete any prerequisites.

> [tab] Nebius AI Cloud CLI
>
> [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI.
>
> The Nebius AI Cloud CLI supports all Object Storage features, as well as other Nebius AI Cloud resources, such as virtual machines and Managed Service for Kubernetes® clusters.
>
> For the commands in this guide to work, set the parent project in the CLI profile. The commands don't include `--parent-id` because they expect this value from the profile:
>
> ```sh theme={null}
> nebius config set parent-id <project_ID>
> ```
>
> You can also provide the project ID explicitly to creation commands, for example, `nebius storage bucket create --parent-id <project_ID> ...`
>
> For more information, see [How to get started with Object Storage: Create your first bucket](https://docs.nebius.com/object-storage/quickstart.md).

> [tab] AWS CLI
>
> [Install and configure the AWS CLI](https://docs.nebius.com/object-storage/interfaces/aws-cli.md). It offers simple commands for bucket management, such as `aws s3 mb` to create buckets and `aws s3 rb` to delete them. For more advanced management, use `aws s3api` commands.
>
> For more information, see [How to get started with Object Storage: Create your first bucket](https://docs.nebius.com/object-storage/quickstart.md).

> [tab] Go SDK
>
> [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md).

> [tab] Python SDK
>
> [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md).

> [tab] JavaScript SDK
>
> [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md).

## How to create buckets

For visual guidance on creating a bucket and uploading objects in the web console, watch the video below. If you prefer other interfaces or written instructions, follow the steps further down.

[YouTube video player](https://www.youtube.com/embed/Cx7BlL6PdKk)

Visit [Nebius Academy](https://academy.nebius.com/trainer/nebius-ai-cloud-onboarding/lesson/b532ba82-1b87-4d8c-ae82-f99afa32d04d) for video tutorials to help you get started with Nebius AI Cloud.

> [tab] Web console
>
> 1. In the sidebar, go to  **Storage** → **Object Storage**.
>
> 2. Click **Create resource** → **Bucket**.
>
> 3. (Optional) Specify the bucket name.
>
>    The bucket name must be unique across the region. For more information, see [Naming](https://docs.nebius.com/object-storage/overview.md#naming).
>
> 4. Set the [bucket parameters](https://docs.nebius.com/object-storage/buckets/manage.md#bucket-parameters).
>
> 5. Click **Create bucket**.

> [tab] Nebius AI Cloud CLI
>
> To create a bucket, run the following command:
>
> ```bash theme={null}
> nebius storage bucket create --name <bucket_name>
> ```
>
> You can extend this command with more parameters. See [Bucket parameters](#bucket-parameters-nebius-ai-cloud-cli) and [Examples](#examples-nebius-ai-cloud-cli).
>
> The bucket name must be unique across the region. For more information, see [Naming](https://docs.nebius.com/object-storage/overview.md#naming).

> [tab] AWS CLI
>
> ```bash theme={null}
> aws s3 mb s3://<bucket_name>
> ```
>
> The `mb` in the command stands for "make bucket."
>
> The bucket name must be unique across the region. For more information, see [Naming](https://docs.nebius.com/object-storage/overview.md#naming).

> [tab] Go SDK
>
> Create a bucket:
>
> ```go theme={null}
> createSvc := sdk.Services().Storage().V1().Bucket()
> createOp, err := createSvc.Create(
>     ctx,
>     &storage.CreateBucketRequest{
>         Metadata: &common.ResourceMetadata{
>             Name: "<bucket_name>",
>         },
>     },
> )
> if err != nil {
>     return err
> }
> if _, err = createOp.Wait(ctx); err != nil {
>     return err
> }
> ```
>
> In the code, set `Metadata.Name` to the bucket name.
>
> You can extend this request with more parameters. See [Examples](#examples-go-sdk).
>
> The bucket name must be unique across the region. For more information, see [Naming](https://docs.nebius.com/object-storage/overview.md#naming).

> [tab] Python SDK
>
> Create a bucket:
>
> ```python theme={null}
> create_service = BucketServiceClient(sdk)
> create_operation = await create_service.create(
>     CreateBucketRequest(
>         metadata=ResourceMetadata(
>             name="<bucket_name>",
>         ),
>     ),
> )
> await create_operation.wait()
> ```
>
> In the code, set `metadata.name` to the bucket name.
>
> You can extend this request with more parameters. See [Examples](#examples-python-sdk).
>
> The bucket name must be unique across the region. For more information, see [Naming](https://docs.nebius.com/object-storage/overview.md#naming).

> [tab] JavaScript SDK
>
> Create a bucket:
>
> ```ts theme={null}
> const createService = new BucketService(sdk);
> const createOperation = await createService.create(
>   CreateBucketRequest.create({
>     metadata: ResourceMetadata.create({
>       name: "<bucket_name>",
>     }),
>   }),
> ).result;
> await createOperation.wait();
> ```
>
> In the code, set `metadata.name` to the bucket name.
>
> You can extend this request with more parameters. See [Examples](#examples-javascript-sdk).
>
> The bucket name must be unique across the region. For more information, see [Naming](https://docs.nebius.com/object-storage/overview.md#naming).

## How to modify buckets

> [tab] Web console
>
> 1. In the sidebar, go to  **Storage** → **Object Storage**.
> 2. Open the page of the required bucket.
> 3. Go to the **Settings** tab.
> 4. Modify the [bucket parameters](#bucket-parameters-web-console).
> 5. Click **Save changes**.

> [tab] Nebius AI Cloud CLI
>
> To modify a bucket and change its [parameters](#bucket-parameters-nebius-ai-cloud-cli), run the following command:
>
> ```bash theme={null}
> nebius storage bucket update --id $BUCKET_ID --max-size-bytes 268435456000
> ```
>
> The bucket is patched by default. Only the parameters specified in the CLI command are changed. To perform a full update, add `--full` to the command. This will update all parameters with the values specified in the command or the default values.

> [tab] Go SDK
>
> Update the bucket's maximum size:
>
> ```go theme={null}
> sizeSvc := sdk.Services().Storage().V1().Bucket()
> sizeBucket, err := sizeSvc.Get(
>     ctx,
>     &storage.GetBucketRequest{
>         Id: "<bucket_ID>",
>     },
> )
> if err != nil {
>     return err
> }
> sizeBucket.Spec.MaxSizeBytes = 268435456000
> sizeOp, err := sizeSvc.Update(
>     ctx,
>     &storage.UpdateBucketRequest{
>         Metadata: sizeBucket.Metadata,
>         Spec:     sizeBucket.Spec,
>     },
> )
> if err != nil {
>     return err
> }
> if _, err = sizeOp.Wait(ctx); err != nil {
>     return err
> }
> ```
>
> In the code, set the following parameters:
>
> * `Id`: Bucket ID.
> * `MaxSizeBytes`: Maximum total size of objects in the bucket, in bytes. The example sets `268435456000`.

> [tab] Python SDK
>
> Update the bucket's maximum size:
>
> ```python theme={null}
> size_service = BucketServiceClient(sdk)
> size_bucket = await size_service.get(
>     GetBucketRequest(id="<bucket_ID>"),
> )
> size_bucket.spec.max_size_bytes = 268435456000
> size_operation = await size_service.update(
>     UpdateBucketRequest(
>         metadata=size_bucket.metadata,
>         spec=size_bucket.spec,
>     ),
> )
> await size_operation.wait()
> ```
>
> In the code, set the following parameters:
>
> * `id`: Bucket ID.
> * `max_size_bytes`: Maximum total size of objects in the bucket, in bytes. The example sets `268435456000`.

> [tab] JavaScript SDK
>
> Update the bucket's maximum size:
>
> ```ts theme={null}
> const sizeService = new BucketService(sdk);
> const sizeBucket = await sizeService.get(
>   GetBucketRequest.create({ id: "<bucket_ID>" }),
> ).result;
> sizeBucket.spec.maxSizeBytes = BigInt(268435456000);
> const sizeOperation = await sizeService.update(
>   UpdateBucketRequest.create({
>     metadata: sizeBucket.metadata,
>     spec: sizeBucket.spec,
>   }),
> ).result;
> await sizeOperation.wait();
> ```
>
> In the code, set the following parameters:
>
> * `id`: Bucket ID.
> * `maxSizeBytes`: Maximum total size of objects in the bucket, in bytes. The example sets `268435456000`.

## Bucket parameters

When creating or modifying a bucket, you can set the following parameters for it:

> [tab] Web console
>
> * **Bucket size**: Specify the bucket's maximum size or select **Unlimited** to have an unlimited capacity.
> * **Storage class**: Select **Standard** for low-cost unlimited capacity or **Enhanced Throughput** for storage that requires high bandwidth and low latency access. For more information, see [Storage classes in Object Storage](https://docs.nebius.com/object-storage/storage-classes.md).
> * **Force storage class**: Overrides the storage class specified explicitly when you upload an object to this bucket.
> * **Versioning**: Allows you to track and record all object changes. For more information, see [Managing bucket versioning](https://docs.nebius.com/object-storage/buckets/versioning.md).
> * **Data plane Audit Logs**: Configures data plane [logging](https://docs.nebius.com/object-storage/logs.md) for the bucket, in addition to always-on control plane logging. To manage this setting, you need the `admin` [role](https://docs.nebius.com/iam/authorization/roles.md) for the bucket, its parent project, or tenant.

> [tab] Nebius AI Cloud CLI
>
> * `--versioning-policy enabled`: Allows versioning of objects in the bucket. For more details, see [Managing bucket versioning](https://docs.nebius.com/object-storage/buckets/versioning.md).
>
> * `--max-size-bytes 107374182400`: Limits the total size of objects in the bucket.
>
> * `--default-storage-class`: Sets the default [storage class](https://docs.nebius.com/object-storage/storage-classes.md) for the objects uploaded to the bucket.
>
> * `--force-storage-class`: Makes the default storage class override storage classes that you specify explicitly when uploading objects to the bucket.
>
> * `--lifecycle-configuration-rules '[{...}, {...}]'`: Adds object lifecycle rules to the bucket. For more information, see an [example below](#examples-nebius-ai-cloud-cli) and [Lifecycle rules for objects in Object Storage](https://docs.nebius.com/object-storage/objects/lifecycles.md).
>
> * `--object-audit-logging <all|mutate_only|none>`: Configures data plane [logging](https://docs.nebius.com/object-storage/logs.md) for the bucket, in addition to always-on control plane logging. To manage this setting, you need the `admin` [role](https://docs.nebius.com/iam/authorization/roles.md) for the bucket, its parent project, or tenant.

> [tab] Go SDK
>
> * `VersioningPolicy`: Allows versioning of objects in the bucket. Set `VersioningPolicy_ENABLED` to enable it. For more details, see [Managing bucket versioning](https://docs.nebius.com/object-storage/buckets/versioning.md).
>
> * `MaxSizeBytes`: Limits the total size of objects in the bucket, in bytes.
>
> * `DefaultStorageClass`: Sets the default [storage class](https://docs.nebius.com/object-storage/storage-classes.md) for the objects uploaded to the bucket.
>
> * `ForceStorageClass`: Set `true` to make the default storage class override storage classes that you specify explicitly when uploading objects to the bucket.
>
> * `LifecycleConfiguration`: Adds object lifecycle rules to the bucket. For more information, see an [example below](#examples-go-sdk) and [Lifecycle rules for objects in Object Storage](https://docs.nebius.com/object-storage/objects/lifecycles.md).
>
> * `ObjectAuditLogging`: Configures data plane [logging](https://docs.nebius.com/object-storage/logs.md) for the bucket, in addition to always-on control plane logging. To manage this setting, you need the `admin` [role](https://docs.nebius.com/iam/authorization/roles.md) for the bucket, its parent project, or tenant.

> [tab] Python SDK
>
> * `versioning_policy`: Allows versioning of objects in the bucket. Set `VersioningPolicy.ENABLED` to enable it. For more details, see [Managing bucket versioning](https://docs.nebius.com/object-storage/buckets/versioning.md).
>
> * `max_size_bytes`: Limits the total size of objects in the bucket, in bytes.
>
> * `default_storage_class`: Sets the default [storage class](https://docs.nebius.com/object-storage/storage-classes.md) for the objects uploaded to the bucket.
>
> * `force_storage_class`: Set `True` to make the default storage class override storage classes that you specify explicitly when uploading objects to the bucket.
>
> * `lifecycle_configuration`: Adds object lifecycle rules to the bucket. For more information, see an [example below](#examples-python-sdk) and [Lifecycle rules for objects in Object Storage](https://docs.nebius.com/object-storage/objects/lifecycles.md).
>
> * `object_audit_logging`: Configures data plane [logging](https://docs.nebius.com/object-storage/logs.md) for the bucket, in addition to always-on control plane logging. To manage this setting, you need the `admin` [role](https://docs.nebius.com/iam/authorization/roles.md) for the bucket, its parent project, or tenant.

> [tab] JavaScript SDK
>
> * `versioningPolicy`: Allows versioning of objects in the bucket. Set `VersioningPolicy.ENABLED` to enable it. For more details, see [Managing bucket versioning](https://docs.nebius.com/object-storage/buckets/versioning.md).
>
> * `maxSizeBytes`: Limits the total size of objects in the bucket, in bytes.
>
> * `defaultStorageClass`: Sets the default [storage class](https://docs.nebius.com/object-storage/storage-classes.md) for the objects uploaded to the bucket.
>
> * `forceStorageClass`: Set `true` to make the default storage class override storage classes that you specify explicitly when uploading objects to the bucket.
>
> * `lifecycleConfiguration`: Adds object lifecycle rules to the bucket. For more information, see an [example below](#examples-javascript-sdk) and [Lifecycle rules for objects in Object Storage](https://docs.nebius.com/object-storage/objects/lifecycles.md).
>
> * `objectAuditLogging`: Configures data plane [logging](https://docs.nebius.com/object-storage/logs.md) for the bucket, in addition to always-on control plane logging. To manage this setting, you need the `admin` [role](https://docs.nebius.com/iam/authorization/roles.md) for the bucket, its parent project, or tenant.

> [!NOTE]
>
> After you enable versioning for an *existing* bucket for the first time, it may take up to 15 minutes to come into effect. We recommend waiting 15 minutes before performing any write operations (`PUT` or `DELETE`) to avoid issues with object visibility and version tracking. If you enable or suspend versioning when *creating* a bucket, it is available immediately with no waiting period.

## How to delete buckets

You can delete a bucket immediately or schedule its deletion. If a bucket is scheduled for deletion, you can [restore the bucket](#how-to-restore-buckets) until it's deleted. After a bucket is deleted, you can't restore it.

Whether you can schedule the deletion depends on the interface and the bucket's contents:

* In the web console, you can schedule the deletion of a non-empty bucket. An empty bucket is deleted immediately.
* In the Nebius AI Cloud CLI and SDKs, you can schedule the deletion of an empty or a non-empty bucket.
* In the AWS CLI, you can't schedule the deletion of any bucket.

> [tab] Web console
>
> To delete a bucket:
>
> 1. In the sidebar, go to  **Storage** → **Object Storage**.
> 2. Find the bucket and then click  → **Delete**.
> 3. In the window that opens:
>
>    1. If the bucket contains objects, select either **Delete now** or **Delete later**. For the **Delete later** option, specify for how long Object Storage should postpone the bucket deletion.
>    2. Confirm the bucket deletion.
>
> If you select **Delete later**, you can't use or modify the bucket while it's scheduled for deletion. The bucket is not visible in the AWS CLI.
>
> > [!NOTE]
> >
> > Nebius AI Cloud still [charges](https://docs.nebius.com/object-storage/resources/pricing.md) you for the bucket scheduled for deletion.

> [tab] Nebius AI Cloud CLI
>
> To delete a bucket:
>
> 1. Get the bucket ID:
>
>    ```bash theme={null}
>    export BUCKET_ID=$(nebius storage bucket get-by-name \
>      --name <bucket_name> --format jsonpath='{.metadata.id}')
>    ```
>
>    The command uses [jq](https://jqlang.github.io/jq/download/) to extract the bucket ID from the JSON output and pass it to the next commands.
>
> 2. Run one of the following commands:
>
>    * Immediately delete an empty bucket:
>
>      > [!WARNING]
>      >
>      > If the bucket has versioning enabled, it may appear empty but still contain old versions of some objects. Make sure that you delete all versions of all objects in the bucket before you run this command. For more details, see [Managing objects in Object Storage buckets](https://docs.nebius.com/object-storage/objects/manage.md).
>
>      ```bash theme={null}
>      nebius storage bucket delete --id $BUCKET_ID
>      ```
>
>    * Immediately delete a non-empty bucket:
>
>      ```bash theme={null}
>      nebius storage bucket delete --id $BUCKET_ID --ttl 0s
>      ```
>
>      `--ttl 0s` specifies bucket deletion after 0 seconds.
>
>    * Schedule bucket deletion:
>
>      * With a delay time:
>
>        ```bash theme={null}
>        nebius storage bucket delete --id $BUCKET_ID --ttl <delay_time>
>        ```
>
>        `--ttl <delay_time>` specifies the time after which the bucket is deleted along with its objects (if any). For example, `--ttl 1h20m30s`.
>
>      * With a timestamp:
>
>        ```bash theme={null}
>        nebius storage bucket delete --id $BUCKET_ID --purge-at <timestamp>
>        ```
>
>        `--purge-at <timestamp>` specifies a future timestamp when the bucket is deleted along with its objects (if any). For example, `--purge-at 2027-01-01T02:30:59Z`.
>
> If you schedule bucket deletion, the bucket status changes to `SCHEDULED_FOR_DELETION`. You can't use or modify the bucket in this status. The bucket is not visible in the AWS CLI.
>
> > [!NOTE]
> >
> > Nebius AI Cloud still [charges](https://docs.nebius.com/object-storage/resources/pricing.md) you for the bucket in the `SCHEDULED_FOR_DELETION` status.

> [tab] AWS CLI
>
> * To delete an empty bucket, run the following command:
>
>   ```bash theme={null}
>   aws s3 rb s3://<bucket_name>
>   ```
>
> * To delete a bucket that contains objects, use the `--force` parameter:
>
>   ```bash theme={null}
>   aws s3 rb s3://<bucket_name> --force
>   ```
>
>   The command deletes the objects and then the bucket.
>
> > [!WARNING]
> >
> > If the bucket has versioning enabled, it may appear empty but still contain old versions of some objects. Both commands fail until you delete those versions. The command with the `--force` parameter deletes current objects only. For more details, see [Managing objects in Object Storage buckets](https://docs.nebius.com/object-storage/objects/manage.md).

> [tab] Go SDK
>
> * Delete an empty bucket:
>
>   ```go theme={null}
>   deleteSvc := sdk.Services().Storage().V1().Bucket()
>   deleteBucket, err := deleteSvc.GetByName(
>       ctx,
>       &storage.GetBucketByNameRequest{
>           Name: "<bucket_name>",
>       },
>   )
>   if err != nil {
>       return err
>   }
>   deleteBucketID := deleteBucket.GetMetadata().GetId()
>   deleteOp, err := deleteSvc.Delete(
>       ctx,
>       &storage.DeleteBucketRequest{
>           Id: deleteBucketID,
>       },
>   )
>   if err != nil {
>       return err
>   }
>   if _, err = deleteOp.Wait(ctx); err != nil {
>       return err
>   }
>   ```
>
>   In the code, set `Name` to the bucket name.
>
>   > [!WARNING]
>   >
>   > If the bucket has versioning enabled, it may appear empty but still contain old versions of some objects. Make sure that you delete all versions of all objects in the bucket before you run this code. For more details, see [Managing objects in Object Storage buckets](https://docs.nebius.com/object-storage/objects/manage.md).
>
> * Schedule deletion after a delay:
>
>   ```go theme={null}
>   ttl, err := time.ParseDuration("<delay_time>")
>   if err != nil {
>       return err
>   }
>   ttlSvc := sdk.Services().Storage().V1().Bucket()
>   ttlOp, err := ttlSvc.Delete(
>       ctx,
>       &storage.DeleteBucketRequest{
>           Id: "<bucket_ID>",
>           Purge: &storage.DeleteBucketRequest_Ttl{
>               Ttl: durationpb.New(ttl),
>           },
>       },
>   )
>   if err != nil {
>       return err
>   }
>   if _, err = ttlOp.Wait(ctx); err != nil {
>       return err
>   }
>   ```
>
>   In the code, set the following parameters:
>
>   * `Id`: Bucket ID.
>   * `Ttl`: Delay after which the bucket and all objects in it are deleted. The code parses `<delay_time>` as a Go duration, for example `1h20m30s`.
>
> * Schedule deletion at a timestamp:
>
>   ```go theme={null}
>   purgeAt, err := time.Parse(time.RFC3339, "<timestamp>")
>   if err != nil {
>       return err
>   }
>   scheduledSvc := sdk.Services().Storage().V1().Bucket()
>   scheduledOp, err := scheduledSvc.Delete(
>       ctx,
>       &storage.DeleteBucketRequest{
>           Id: "<bucket_ID>",
>           Purge: &storage.DeleteBucketRequest_PurgeAt{
>               PurgeAt: timestamppb.New(purgeAt),
>           },
>       },
>   )
>   if err != nil {
>       return err
>   }
>   if _, err = scheduledOp.Wait(ctx); err != nil {
>       return err
>   }
>   ```
>
>   In the code, set the following parameters:
>
>   * `Id`: Bucket ID.
>   * `PurgeAt`: Timestamp when the bucket and all objects in it are deleted. The code parses `<timestamp>` as RFC 3339, for example `2025-01-01T18:33:31Z`.
>
>   The bucket is put into the `SCHEDULED_FOR_DELETION` status, and after the specified time passes, it is deleted. When the bucket is in this status, you cannot use or update it, but you can [restore it](#how-to-restore-buckets-go-sdk).
>
> > [!NOTE]
> >
> > Nebius AI Cloud still [charges](https://docs.nebius.com/object-storage/resources/pricing.md) you for the bucket in the `SCHEDULED_FOR_DELETION` status.

> [tab] Python SDK
>
> * Delete an empty bucket:
>
>   ```python theme={null}
>   delete_service = BucketServiceClient(sdk)
>   delete_bucket = await delete_service.get_by_name(
>       GetBucketByNameRequest(name="<bucket_name>"),
>   )
>   delete_bucket_id = delete_bucket.metadata.id
>   delete_operation = await delete_service.delete(
>       DeleteBucketRequest(id=delete_bucket_id),
>   )
>   await delete_operation.wait()
>   ```
>
>   In the code, set `name` to the bucket name.
>
>   > [!WARNING]
>   >
>   > If the bucket has versioning enabled, it may appear empty but still contain old versions of some objects. Make sure that you delete all versions of all objects in the bucket before you run this code. For more details, see [Managing objects in Object Storage buckets](https://docs.nebius.com/object-storage/objects/manage.md).
>
> * Schedule deletion after a delay:
>
>   ```python theme={null}
>   delay = "<delay_time>"
>   ttl = timedelta(hours=int(delay.removesuffix("h")))
>   ttl_service = BucketServiceClient(sdk)
>   ttl_operation = await ttl_service.delete(
>       DeleteBucketRequest(
>           id="<bucket_ID>",
>           ttl=ttl,
>       ),
>   )
>   await ttl_operation.wait()
>   ```
>
>   In the code, set the following parameters:
>
>   * `id`: Bucket ID.
>   * `ttl`: Delay after which the bucket and all objects in it are deleted. The code reads `<delay_time>` as a number of hours followed by `h`, for example `2h`.
>
> * Schedule deletion at a timestamp:
>
>   ```python theme={null}
>   purge_at = datetime.fromisoformat(
>       "<timestamp>".replace("Z", "+00:00"),
>   )
>   scheduled_service = BucketServiceClient(sdk)
>   scheduled_operation = await scheduled_service.delete(
>       DeleteBucketRequest(
>           id="<bucket_ID>",
>           purge_at=purge_at,
>       ),
>   )
>   await scheduled_operation.wait()
>   ```
>
>   In the code, set the following parameters:
>
>   * `id`: Bucket ID.
>   * `purge_at`: Timestamp when the bucket and all objects in it are deleted. The code reads `<timestamp>` as an ISO 8601 time, for example `2025-01-01T18:33:31Z`.
>
>   The bucket is put into the `SCHEDULED_FOR_DELETION` status, and after the specified time passes, it is deleted. When the bucket is in this status, you cannot use or update it, but you can [restore it](#how-to-restore-buckets-python-sdk).
>
> > [!NOTE]
> >
> > Nebius AI Cloud still [charges](https://docs.nebius.com/object-storage/resources/pricing.md) you for the bucket in the `SCHEDULED_FOR_DELETION` status.

> [tab] JavaScript SDK
>
> * Delete an empty bucket:
>
>   ```ts theme={null}
>   const deleteService = new BucketService(sdk);
>   const deleteBucket = await deleteService.getByName(
>     GetBucketByNameRequest.create({
>       name: "<bucket_name>",
>     }),
>   ).result;
>   const deleteBucketId = deleteBucket.metadata.id;
>   const deleteOperation = await deleteService.delete(
>     DeleteBucketRequest.create({ id: deleteBucketId }),
>   ).result;
>   await deleteOperation.wait();
>   ```
>
>   In the code, set `name` to the bucket name.
>
>   > [!WARNING]
>   >
>   > If the bucket has versioning enabled, it may appear empty but still contain old versions of some objects. Make sure that you delete all versions of all objects in the bucket before you run this code. For more details, see [Managing objects in Object Storage buckets](https://docs.nebius.com/object-storage/objects/manage.md).
>
> * Schedule deletion after a delay:
>
>   ```ts theme={null}
>   dayjs.extend(duration);
>   const ttlSeconds = Number(
>     "<delay_time>".slice(0, -1),
>   ) * 3600;
>   const ttlDuration = dayjs.duration(ttlSeconds, "seconds");
>   const ttlService = new BucketService(sdk);
>   const ttlOperation = await ttlService.delete(
>     DeleteBucketRequest.create({
>       id: "<bucket_ID>",
>       purge: {
>         $case: "ttl",
>         ttl: ttlDuration,
>       },
>     }),
>   ).result;
>   await ttlOperation.wait();
>   ```
>
>   In the code, set the following parameters:
>
>   * `id`: Bucket ID.
>   * `purge.ttl`: Delay after which the bucket and all objects in it are deleted. The code reads `<delay_time>` as a number of hours with a one-character suffix, for example `2h`.
>
> * Schedule deletion at a timestamp:
>
>   ```ts theme={null}
>   const scheduledService = new BucketService(sdk);
>   const scheduledOperation = await scheduledService.delete(
>     DeleteBucketRequest.create({
>       id: "<bucket_ID>",
>       purge: {
>         $case: "purgeAt",
>         purgeAt: dayjs("<timestamp>"),
>       },
>     }),
>   ).result;
>   await scheduledOperation.wait();
>   ```
>
>   In the code, set the following parameters:
>
>   * `id`: Bucket ID.
>   * `purge.purgeAt`: Timestamp when the bucket and all objects in it are deleted. The code reads `<timestamp>` as an ISO 8601 time, for example `2025-01-01T18:33:31Z`.
>
>   The bucket is put into the `SCHEDULED_FOR_DELETION` status, and after the specified time passes, it is deleted. When the bucket is in this status, you cannot use or update it, but you can [restore it](#how-to-restore-buckets-javascript-sdk).
>
> > [!NOTE]
> >
> > Nebius AI Cloud still [charges](https://docs.nebius.com/object-storage/resources/pricing.md) you for the bucket in the `SCHEDULED_FOR_DELETION` status.

### How to immediately delete a bucket scheduled for deletion

To delete a bucket before its scheduled deletion time:

> [tab] Web console
>
> 1. In the [web console](https://console.nebius.com), go to  **Storage** → **Object Storage**.
> 2. Go to the **Deleted** tab.
> 3. Locate the bucket and then click  → **Delete now**.
> 4. Confirm the bucket deletion.

> [tab] Nebius AI Cloud CLI
>
> Run the following command:
>
> ```bash theme={null}
> nebius storage bucket purge --id $BUCKET_ID
> ```

> [tab] Go SDK
>
> Delete the bucket immediately:
>
> ```go theme={null}
> purgeSvc := sdk.Services().Storage().V1().Bucket()
> purgeOp, err := purgeSvc.Purge(
>     ctx,
>     &storage.PurgeBucketRequest{
>         Id: "<bucket_ID>",
>     },
> )
> if err != nil {
>     return err
> }
> if _, err = purgeOp.Wait(ctx); err != nil {
>     return err
> }
> ```
>
> In the code, set `Id` to the bucket ID.

> [tab] Python SDK
>
> Delete the bucket immediately:
>
> ```python theme={null}
> purge_service = BucketServiceClient(sdk)
> purge_operation = await purge_service.purge(
>     PurgeBucketRequest(id="<bucket_ID>"),
> )
> await purge_operation.wait()
> ```
>
> In the code, set `id` to the bucket ID.

> [tab] JavaScript SDK
>
> Delete the bucket immediately:
>
> ```ts theme={null}
> const purgeService = new BucketService(sdk);
> const purgeOperation = await purgeService.purge(
>   PurgeBucketRequest.create({ id: "<bucket_ID>" }),
> ).result;
> await purgeOperation.wait();
> ```
>
> In the code, set `id` to the bucket ID.

## How to restore buckets

You can restore a bucket until its scheduled deletion time. To restore the bucket:

> [tab] Web console
>
> 1. In the sidebar, go to  **Storage** → **Object Storage**.
> 2. Go to the **Deleted** tab.
> 3. Locate the bucket and then click **Restore**.
> 4. Confirm the bucket restoration.

> [tab] Nebius AI Cloud CLI
>
> Run the following command:
>
> ```bash theme={null}
> nebius storage bucket undelete --id $BUCKET_ID
> ```

> [tab] Go SDK
>
> Restore the bucket:
>
> ```go theme={null}
> undeleteSvc := sdk.Services().Storage().V1().Bucket()
> undeleteOp, err := undeleteSvc.Undelete(
>     ctx,
>     &storage.UndeleteBucketRequest{
>         Id: "<bucket_ID>",
>     },
> )
> if err != nil {
>     return err
> }
> if _, err = undeleteOp.Wait(ctx); err != nil {
>     return err
> }
> ```
>
> In the code, set `Id` to the bucket ID.

> [tab] Python SDK
>
> Restore the bucket:
>
> ```python theme={null}
> undelete_service = BucketServiceClient(sdk)
> undelete_operation = await undelete_service.undelete(
>     UndeleteBucketRequest(id="<bucket_ID>"),
> )
> await undelete_operation.wait()
> ```
>
> In the code, set `id` to the bucket ID.

> [tab] JavaScript SDK
>
> Restore the bucket:
>
> ```ts theme={null}
> const undeleteService = new BucketService(sdk);
> const undeleteOperation = await undeleteService.undelete(
>   UndeleteBucketRequest.create({ id: "<bucket_ID>" }),
> ).result;
> await undeleteOperation.wait();
> ```
>
> In the code, set `id` to the bucket ID.

## Examples

> [tab] Nebius AI Cloud CLI
>
> * Creating a bucket with total objects size limited to 250 GiB (268,435,456,000 bytes):
>
>   ```bash theme={null}
>   nebius storage bucket create --name <bucket_name> \
>     --max-size-bytes 268435456000
>   ```
>
> * Creating a bucket with an object lifecycle rule that deletes objects 90 days after their creation:
>
>   ```bash theme={null}
>   nebius storage bucket create --name <bucket_name> \
>     --lifecycle-configuration-rules '[{
>       "id": "lifecycle-delete-90-days-objects",
>       "status": "ENABLED",
>       "filter": {
>         "prefix": ""
>       },
>       "expiration": {
>         "days": 90
>       }
>     }]'
>   ```
>
> * Creating a bucket with a forced Standard default storage class that overrides the storage class that you select explicitly for any individual object uploaded to the bucket:
>
>   ```bash theme={null}
>   nebius storage bucket create --name <bucket_name> \
>     --default-storage-class standard \
>     --force-storage-class
>   ```

> [tab] Go SDK
>
> * Creating a bucket with total objects size limited to 250 GiB (268,435,456,000 bytes):
>
>   ```go theme={null}
>   maxSvc := sdk.Services().Storage().V1().Bucket()
>   maxOp, err := maxSvc.Create(
>       ctx,
>       &storage.CreateBucketRequest{
>           Metadata: &common.ResourceMetadata{
>               Name: "<bucket_name>",
>           },
>           Spec: &storage.BucketSpec{
>               MaxSizeBytes: 268435456000,
>           },
>       },
>   )
>   if err != nil {
>       return err
>   }
>   if _, err = maxOp.Wait(ctx); err != nil {
>       return err
>   }
>   ```
>
>   In the code, set `Metadata.Name` to the bucket name and `MaxSizeBytes` to `268435456000`.
>
> * Creating a bucket with an object lifecycle rule that deletes objects 90 days after their creation:
>
>   ```go theme={null}
>   lifecycleSvc := sdk.Services().Storage().V1().Bucket()
>   lifecycleOp, err := lifecycleSvc.Create(
>       ctx,
>       &storage.CreateBucketRequest{
>           Metadata: &common.ResourceMetadata{
>               Name: "<bucket_name>",
>           },
>           Spec: &storage.BucketSpec{
>               LifecycleConfiguration: &storage.LifecycleConfiguration{
>                   Rules: []*storage.LifecycleRule{
>                       {
>                           Id:     "lifecycle-delete-90-days-objects",
>                           Status: storage.LifecycleRule_ENABLED,
>                           Filter: &storage.LifecycleFilter{
>                               Prefix: "",
>                           },
>                           Expiration: &storage.LifecycleExpiration{
>                               ExpiredWith: &storage.
>                                   LifecycleExpiration_Days{
>                                   Days: 90,
>                               },
>                           },
>                       },
>                   },
>               },
>           },
>       },
>   )
>   if err != nil {
>       return err
>   }
>   if _, err = lifecycleOp.Wait(ctx); err != nil {
>       return err
>   }
>   ```
>
>   In the code, set the following parameters:
>
>   * `Metadata.Name`: Bucket name.
>   * `Id`: Rule ID. The example uses `lifecycle-delete-90-days-objects`.
>   * `Status`: `LifecycleRule_ENABLED`.
>   * `Filter.Prefix`: Object key prefix. The example uses an empty prefix, so the rule applies to all objects.
>   * `Expiration.Days`: `90`.
>
> * Creating a bucket with a forced Standard default storage class that overrides the storage class that you select explicitly for any individual object uploaded to the bucket:
>
>   ```go theme={null}
>   classSvc := sdk.Services().Storage().V1().Bucket()
>   classOp, err := classSvc.Create(
>       ctx,
>       &storage.CreateBucketRequest{
>           Metadata: &common.ResourceMetadata{
>               Name: "<bucket_name>",
>           },
>           Spec: &storage.BucketSpec{
>               DefaultStorageClass: storage.StorageClass_STANDARD,
>               ForceStorageClass:   true,
>           },
>       },
>   )
>   if err != nil {
>       return err
>   }
>   if _, err = classOp.Wait(ctx); err != nil {
>       return err
>   }
>   ```
>
>   In the code, set the following parameters:
>
>   * `Metadata.Name`: Bucket name.
>   * `DefaultStorageClass`: `StorageClass_STANDARD`.
>   * `ForceStorageClass`: `true`.

> [tab] Python SDK
>
> * Creating a bucket with total objects size limited to 250 GiB (268,435,456,000 bytes):
>
>   ```python theme={null}
>   max_service = BucketServiceClient(sdk)
>   max_operation = await max_service.create(
>       CreateBucketRequest(
>           metadata=ResourceMetadata(
>               name="<bucket_name>",
>           ),
>           spec=BucketSpec(max_size_bytes=268435456000),
>       ),
>   )
>   await max_operation.wait()
>   ```
>
>   In the code, set `metadata.name` to the bucket name and `max_size_bytes` to `268435456000`.
>
> * Creating a bucket with an object lifecycle rule that deletes objects 90 days after their creation:
>
>   ```python theme={null}
>   lifecycle_service = BucketServiceClient(sdk)
>   lifecycle_operation = await lifecycle_service.create(
>       CreateBucketRequest(
>           metadata=ResourceMetadata(
>               name="<bucket_name>",
>           ),
>           spec=BucketSpec(
>               lifecycle_configuration=LifecycleConfiguration(
>                   rules=[
>                       LifecycleRule(
>                           id="lifecycle-delete-90-days-objects",
>                           status=LifecycleRule.Status.ENABLED,
>                           filter=LifecycleFilter(prefix=""),
>                           expiration=LifecycleExpiration(days=90),
>                       ),
>                   ],
>               ),
>           ),
>       ),
>   )
>   await lifecycle_operation.wait()
>   ```
>
>   In the code, set the following parameters:
>
>   * `metadata.name`: Bucket name.
>   * `id`: Rule ID. The example uses `lifecycle-delete-90-days-objects`.
>   * `status`: `LifecycleRule.Status.ENABLED`.
>   * `filter.prefix`: Object key prefix. The example uses an empty prefix, so the rule applies to all objects.
>   * `expiration.days`: `90`.
>
> * Creating a bucket with a forced Standard default storage class that overrides the storage class that you select explicitly for any individual object uploaded to the bucket:
>
>   ```python theme={null}
>   class_service = BucketServiceClient(sdk)
>   class_operation = await class_service.create(
>       CreateBucketRequest(
>           metadata=ResourceMetadata(
>               name="<bucket_name>",
>           ),
>           spec=BucketSpec(
>               default_storage_class=StorageClass.STANDARD,
>               force_storage_class=True,
>           ),
>       ),
>   )
>   await class_operation.wait()
>   ```
>
>   In the code, set the following parameters:
>
>   * `metadata.name`: Bucket name.
>   * `default_storage_class`: `StorageClass.STANDARD`.
>   * `force_storage_class`: `True`.

> [tab] JavaScript SDK
>
> * Creating a bucket with total objects size limited to 250 GiB (268,435,456,000 bytes):
>
>   ```ts theme={null}
>   const maxService = new BucketService(sdk);
>   const maxOperation = await maxService.create(
>     CreateBucketRequest.create({
>       metadata: ResourceMetadata.create({
>         name: "<bucket_name>",
>       }),
>       spec: BucketSpec.create({
>         maxSizeBytes: BigInt(268435456000),
>       }),
>     }),
>   ).result;
>   await maxOperation.wait();
>   ```
>
>   In the code, set `metadata.name` to the bucket name and `maxSizeBytes` to `268435456000`.
>
> * Creating a bucket with an object lifecycle rule that deletes objects 90 days after their creation:
>
>   ```ts theme={null}
>   const lifecycleService = new BucketService(sdk);
>   const lifecycleOperation = await lifecycleService.create(
>     CreateBucketRequest.create({
>       metadata: ResourceMetadata.create({
>         name: "<bucket_name>",
>       }),
>       spec: BucketSpec.create({
>         lifecycleConfiguration: LifecycleConfiguration.create({
>           rules: [
>             LifecycleRule.create({
>               id: "lifecycle-delete-90-days-objects",
>               status: LifecycleRule_Status.ENABLED,
>               filter: LifecycleFilter.create({ prefix: "" }),
>               expiration: LifecycleExpiration.create({
>                 expiredWith: {
>                   $case: "days",
>                   days: 90,
>                 },
>               }),
>             }),
>           ],
>         }),
>       }),
>     }),
>   ).result;
>   await lifecycleOperation.wait();
>   ```
>
>   In the code, set the following parameters:
>
>   * `metadata.name`: Bucket name.
>   * `id`: Rule ID. The example uses `lifecycle-delete-90-days-objects`.
>   * `status`: `LifecycleRule_Status.ENABLED`.
>   * `filter.prefix`: Object key prefix. The example uses an empty prefix, so the rule applies to all objects.
>   * `expiration.expiredWith.days`: `90`.
>
> * Creating a bucket with a forced Standard default storage class that overrides the storage class that you select explicitly for any individual object uploaded to the bucket:
>
>   ```ts theme={null}
>   const classService = new BucketService(sdk);
>   const classOperation = await classService.create(
>     CreateBucketRequest.create({
>       metadata: ResourceMetadata.create({
>         name: "<bucket_name>",
>       }),
>       spec: BucketSpec.create({
>         defaultStorageClass: StorageClass.STANDARD,
>         forceStorageClass: true,
>       }),
>     }),
>   ).result;
>   await classOperation.wait();
>   ```
>
>   In the code, set the following parameters:
>
>   * `metadata.name`: Bucket name.
>   * `defaultStorageClass`: `StorageClass.STANDARD`.
>   * `forceStorageClass`: `true`.
