# Delete remote state bucket

After destroying each stack using `terraform destroy`, manually delete the S3 bucket used for remote state storage. Terraform does not support deleting S3 buckets that are not empty.

## Using the AWS CLI

List the buckets in the AWS account:

```bash
aws s3 ls
```

```bash
2020-01-01 00:00:00 ok-iac-config-12345678910-eu-west-1-my-team-dev
```

Delete the bucket:

```bash
aws s3 rb s3://ok-iac-config-12345678910-eu-west-1-my-team-dev --force
```

## Using the AWS Management Console

<!-- prettier-ignore-start -->
!!! info "Bucket name"
    The name of the bucket is inherited from the `metadata.environment` value in the `env.yml` file.

    ```text title="Example bucket name"
    ok-iac-config-12345678910-eu-west-1-my-team-dev
    ```
<!-- prettier-ignore-end -->

1. Go to the AWS console and navigate to the [S3 list](https://s3.console.aws.amazon.com/s3/home?region=eu-west-1){:target="_blank"}.
1. Click on the bucket that was created by the `remote_state` stack.
1. Click on the **Empty** button.
1. Click on the **Delete** button.

## Verification

List the buckets again and confirm the deleted bucket is no longer in the output:

```bash
aws s3 ls
```
