Teardown
Teardown order
Section titled “Teardown order”Delete interconnect resources in this order, then destroy TERRAFORM
HashiCorp Terraform — infrastructure-as-code tool used to provision the base AWS and GCP resources in this demo. :
| Order | What | Stops billing? |
|---|---|---|
| 1 | GCP VPC peering | — |
| 2 | GCP transport | ~$5/hr GCP |
| 3 | AWS multicloud Interconnect | ~$1.37/hr AWS (after delete completes) |
| 4 | Wait — AWS list-connections empty | — |
| 5 | terraform destroy | ~$30–40/mo base infra |
| 6 | Remove | — (gitignored secrets) |
Set environment variables
Section titled “Set environment variables”Run from your workstation in the repo directory:
export GCP_PROJECT="$(terraform output -raw gcp_project_id)"export GCP_REGION="$(terraform output -raw gcp_region)"export GCP_NETWORK="$(terraform output -raw gcp_vpc_network_name)"export TRANSPORT_NAME="$(terraform output -raw gcp_transport_name)"export AWS_REGION="$(terraform output -raw aws_region)"Optional — confirm nothing is still in use before deleting:
aws interconnect list-connections --region "$AWS_REGION" \ --query 'connections[*].{id:id,state:state,description:description}' \ --output table
gcloud beta network-connectivity transports describe "$TRANSPORT_NAME" \ --region="$GCP_REGION" --project="$GCP_PROJECT" \ --format='value(state)'1. GCP — delete VPC peering
Section titled “1. GCP — delete VPC peering”Delete peering before the transport (GCP teardown order).
gcloud compute networks peerings delete demo-aws-peering \ --network="$GCP_NETWORK" \ --project="$GCP_PROJECT" \ --quiet2. GCP — delete transport
Section titled “2. GCP — delete transport”gcloud beta network-connectivity transports delete "$TRANSPORT_NAME" \ --region="$GCP_REGION" \ --project="$GCP_PROJECT" \ --quiet3. AWS — delete multicloud Interconnect
Section titled “3. AWS — delete multicloud Interconnect”Console: AWS Interconnect — set region= to your aws_region. Delete demo-interconnect.
CLI (AWS CLI ≥ 2.34.43):
CONN_ID="$(aws interconnect list-connections --region "$AWS_REGION" \ --query 'connections[?description==`demo-interconnect`].id | [0]' --output text)"
aws interconnect delete-connection \ --identifier "$CONN_ID" \ --region "$AWS_REGION"The API returns "state": "deleting" immediately — that is not finished yet.
4. Wait for AWS delete to finish
Section titled “4. Wait for AWS delete to finish”Do not run terraform destroy while AWS still shows deleting.
Poll until the interconnect list is empty:
aws interconnect list-connections --region "$AWS_REGION" \ --query 'connections[*].{id:id,state:state,description:description}' \ --output table| Result | Safe to proceed? |
|---|---|
| Empty table | Yes |
state: | No — wait |
state: | No — delete not started or failed |
Confirm GCP
Google Cloud Platform — the cloud provider connected to AWS via Interconnect multicloud in this walkthrough. is clean (expect Listed 0 items for both after Steps 1–2):
gcloud beta network-connectivity transports list \ --region="$GCP_REGION" --project="$GCP_PROJECT"
gcloud compute networks peerings list \ --network="$GCP_NETWORK" --project="$GCP_PROJECT"5. Terraform — destroy base infrastructure
Section titled “5. Terraform — destroy base infrastructure”Only after AWS list-connections is empty:
terraform destroy6. Local cleanup — remove SSH keys
Section titled “6. Local cleanup — remove SSH keys”Remove the GCE key files saved in Step 7:
rm -f demo-gce-key demo-gce-key.pub