Comment on page
Removing an AWS region
You may at some point decide you want to abandon an AWS region you're using. Perhaps your traffic has shifted, perhaps your architecture's changed, or perhaps it's for some other reason. No matter, here's how you remove a region from Substrate's management and your root Terraform modules.
First and foremost, if you're going to remove a region and all the infrastructure there, ensure you're not going to cause an outage or data loss when you do. Ensure that services will continue to operate, either by having sufficient capacity elsewhere or by proactively draining traffic from the region that's about to be removed. Ensure any data stored in the region is available in at least one but preferably two other regions.
substrate setup -fully-interactive. When prompted if your region list is accurate, respond “no”, and remove the region from your list of regions. When this command exits, you'll have a great many directories in
root-modulesthat reference the region which will no longer be managed by any Substrate tools.
find root-modules -name <region>to list all the root modules that run in the region. Starting with your admin and service accounts, run
terraform destroyin each one and then
rm -f -rthat directory.
find root-modules/network/peering -name <region>to list all the root modules that manage network peering relationships that involve the region. Run
rm -f -rfor each one, just as you did for service accounts before.
find root-modules -name <region>again and run
rm -f -rfor everything that's left. It's likely that you'll have to destroy the networks twice to fully resolve Terraform's dependencies.