rb

Prev Next

Available in Classic and VPC

Delete an empty bucket in Object Storage.

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 the bucket after deleting all objects in the bucket.
  • If left blank, buckets that are not empty can't be deleted.

Common options

For information about the options common to all aws subcommands, see Object 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.object.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.object.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/docs/report.txt
delete: s3://my-temp-bucket/sample.txt
remove_bucket: my-temp-bucket