How to Delete an Amazon AWS S3 Bucket

How to Delete an Amazon AWS S3 Bucket

IMPORTANT : You will lose data when you delete a bucket that contain objects. The bucket name might not be available if you wish to reuse the same bucket name later. It is better to empty the bucket instead of deleting if you want to use the same bucket name for creating a new bucket.

You can delete Amazon S3 bucket either through Amazon AWS console, AWS CLI or AWS SDK. All the objects will be permanently deleted when you delete the S3 bucket. If you delete a bucket with versioning enabled then all the version of the object will be permanently deleted.

Do the below steps to delete an AWS S3 bucket

1. Log in to AWS management console

2. Click on ‘S3’ under ‘Storage’


Open the link in web browser to access S3 console

3. Tick the checkbox next to the name of the bucket you wish to delete

Remove an S3 bucket

Remove an S3 bucket

copy the name of the bucket you wish to delete.

4. Click on ‘Delete’ and it shows ask for confirmation before deleting

Paste the name of the bucket in the ‘Type the name of the bucket to confirm deletion:’ field.

5. Choose ‘Confirm’ after entering the bucket name.

This will delete the bucket and all the contents.

Note : You can’t delete multiple buckets at a time. You can delete only one bucket at a time. Delete button will be grayed out if you select multiple buckets to delete.

6. Scroll down to see the progress of bucket deletion.

Delete s3 bucket successful

Delete s3 bucket successful


Delete Amazon S3 bucket through CLI

Note : AWS CLI has limitation, you cannot delete a versioning enabled S3 bucket using AWS CLI.

To interact with AWS through CLI, you must install awscli and configure security credentials (Access key and secret key)

1. Log into terminal

2. Run the command ‘aws s3 ls’ to list all S3 buckets

3. Execute the command ‘aws s3 rb s3://name-of-the-bucket –force’ to delete the bucket and contents

rb = remove bucket
name-of-the-bucket = This should be replaced with name of the bucket
–force = Use –force to delete a non empty bucket


root@ip- aws s3 ls
2017-12-30 18:57:37 test-bucket-123z
root@ip- aws s3 rb s3://test-bucket-123z –force
remove_bucket: test-bucket-123z
root@ip- aws s3 ls


CLI will delete the bucket after deleting all the objects in the bucket.

Use SDK to delete version enabled bucket.


Delete amazon s3 bucket using Python SDK

1. Log into terminal

Install boto3 if it is not installed.

2. Save the below script in any .py extension file

import boto3
s3 = boto3.resource(‘s3’)
bucket = s3.Bucket(‘name-of-the-bucket’)

3. Execute ‘python’ to delete the bucket

4. Run the command ‘aws s3 ls’ to confirm it is deleted.