Nov 22, 2018

AWS: How to delete a static website via aws cli

After the creation of a static website in S3 via cli, now the deletion:

First try was:

$ aws s3api delete-bucket --bucket my.webtest



An error occurred (BucketNotEmpty) when calling the DeleteBucket operation: The bucket you tried to delete is not empty
Ok. This will not work. First get the objects:

$ aws s3api list-objects --bucket my.webtest

{

    "Contents": [

        {

            "LastModified": "2018-11-17T19:18:53.000Z", 

            "ETag": "\"e56b419be959169c15260cd721735e47\"", 

            "StorageClass": "STANDARD", 

            "Key": "index.html", 

            "Owner": {

                "DisplayName": "d.schroff", 

                "ID": "6c301aed95f62fb17532da6c93209c898a1e07051e520c6bb7fab30769cc495c"

            }, 

            "Size": 568

        }

    ]

}
and the bucket can be deleted:
$ aws s3api delete-bucket --bucket my.webtest
A crosscheck via web console:


And the website is not there anymore:

1 comment: