Cleanup: Deleting the objects and the S3 bucket

Deleting your objects (including different versions) and your bucket

The deletion of objects and buckets can be done programmatically through the API or via the console. If you no longer need the bucket and the objects you uploaded for this lab, you should delete them so you do not incur further charges on those objects.

You could go through the bucket and delete every file individually, but that is unnecessary when we can delete them all with one action.

Delete all objects using the Empty bucket feature

If you want to delete all objects within a bucket at once, you can use the Empty option in the S3 console:

1.In the S3 console select the radio button to the left of your bucket and then select the Empty button.

2.You will be taken to the “Empty bucket” page where it gives you several warnings and requires you to type permanently delete in the confirmation field. Once entered you can then click on the Empty button to remove all the objects permanently.

3.You will then be taken to the “Empty bucket: status” page with a message that you successfully emptied your bucket. Click on Exit to return to the S3 console

Delete your bucket

1.In the S3 console click on your bucket named [your-bucket-name] to open the overview page.

2.Your bucket should now be empty. Click on the toggle labeled “Show Versions” to confirm there aren’t any previous versions of objects still in your bucket.

3.Return to the “Buckets” page in the S3 console, select the radio button to the left of your bucket, and then select the Delete button.

4.On the “Delete bucket” page you will need to type in [your-bucket-name] in the text input field and then click on Delete bucket.

5.Once deleted you will be returned to the S3 buckets page with the message “Successfully deleted bucket [your-bucket-name]”.

Deleting your CloudFormation Stack

1.In the console open CloudFormation under services or with search.

2.Select the stack named [Your Initials]-S3-Web-Host and then the Delete button.

3.In the popup select Delete stack.

4.The stack will take a few minutes to delete, select the refresh button to see the updated status. The stack will no longer be visible when it is deleted.