Skip to content

Delete the remote state bucket

After destroying each stack using terraform destroy, you will need to manually delete the S3 bucket used for remote state storage. This is because 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

Bucket name

The name of the bucket is inherited from the metadata.environment value in the env.yml file.

Example bucket name
  1. Go to the AWS console and navigate to the S3 list.
  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.