> **Page index:** https://km.oslo.systems/llms.txt lists every page on this site, with a link to its Markdown version.

# 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:

```
aws s3 ls
```

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

Delete the bucket:

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

## Using the AWS Management Console

> [!NOTE]
>
> **Bucket name**
>
> The name of the bucket is inherited from the `metadata.environment` value in the `env.yml` file.
>
> Example bucket name
>
> ```
> ok-iac-config-12345678910-eu-west-1-my-team-dev
> ```

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

## Verification

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

```
aws s3 ls
```
