Table Of Contents


User Guide

First time using the AWS CLI? See the User Guide for help getting started.

Note: You are viewing the documentation for an older major version of the AWS CLI (version 1).

AWS CLI version 2, the latest major version of AWS CLI, is now stable and recommended for general use. To view this page for the AWS CLI version 2, click here. For more information see the AWS CLI version 2 installation instructions and migration guide.

[ aws . s3 ]



Deletes an empty S3 bucket. A bucket must be completely empty of objects and versioned objects before it can be deleted. However, the --force parameter can be used to delete the non-versioned objects in the bucket before the bucket is deleted.

See 'aws help' for descriptions of global parameters.




path (string)

--force (boolean) Deletes all objects in the bucket including the bucket itself. Note that versioned objects will not be deleted in this process which would cause the bucket deletion to fail because the bucket would not be empty. To delete versioned objects use the s3api delete-object command with the --version-id parameter.

See 'aws help' for descriptions of global parameters.


The following rb command removes a bucket. In this example, the user's bucket is mybucket. Note that the bucket must be empty in order to remove:

aws s3 rb s3://mybucket


remove_bucket: mybucket

The following rb command uses the --force parameter to first remove all of the objects in the bucket and then remove the bucket itself. In this example, the user's bucket is mybucket and the objects in mybucket are test1.txt and test2.txt:

aws s3 rb s3://mybucket --force


delete: s3://mybucket/test1.txt
delete: s3://mybucket/test2.txt
remove_bucket: mybucket