rb

Prev Next

Available in Classic and VPC

Delete an empty bucket in Ncloud Storage.

Caution

Deleted buckets and objects cannot be recovered. Using the --force option will delete all objects in the bucket before deleting the bucket itself, so verify the target bucket before running this command.

Syntax

The rb syntax is as follows:

aws s3 rb \
    <s3-uri> \
    [--force] \
    --endpoint-url <endpoint-url>

Options

This section describes the options available when running rb.

Required options

The following options are required for rb.

Options Type Required Description
<s3-uri> String Required Bucket S3 URI
  • s3://{bucket_name} format

Optional options

These are the optional options for rb. Options that are not specified will use their default values.

Options Type Required Description
--force Boolean Optional Deletes all objects in the bucket, then deletes the bucket.
  • Objects with version IDs cannot be deleted.

Common options

For information about the options common to all aws subcommands, see Ncloud Storage options.

Examples

When you run the command, the name of the deleted bucket is displayed. If you use the --force option, the path of the deleted object is also displayed.

Command

The following is an example command for deleting an empty bucket.

aws s3 rb s3://my-temp-bucket \
    --endpoint-url=https://kr.ncloudstorage.com

The following is an example command for deleting a non-empty bucket along with its objects.

aws s3 rb s3://my-temp-bucket \
    --force \
    --endpoint-url=https://kr.ncloudstorage.com

Output

The following is an example output for deleting an empty bucket.

remove_bucket: my-temp-bucket

The following is an example output for deleting a non-empty bucket along with its objects.

delete: s3://my-temp-bucket/img/photo.jpg
delete: s3://my-temp-bucket/docs/report.txt
remove_bucket: my-temp-bucket

If you delete a non-empty bucket without the --force option, the following error message is displayed.

remove_bucket failed: s3://my-temp-bucket An error occurred (BucketNotEmpty) when calling the DeleteBucket operation: The bucket you tried to delete is not empty.