Skip to content

Teardown

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

OrderWhatStops billing?
1GCP VPC peering
2GCP transport~$5/hr GCP
3AWS multicloud Interconnect~$1.37/hr AWS (after delete completes)
4Wait — AWS list-connections empty
5terraform destroy~$30–40/mo base infra
6

Remove demo-gce-key*

— (gitignored secrets)

Run from your workstation in the repo directory:

Terminal window
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:

Terminal window
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)'

Delete peering before the transport (GCP teardown order).

Terminal window
gcloud compute networks peerings delete demo-aws-peering \
--network="$GCP_NETWORK" \
--project="$GCP_PROJECT" \
--quiet
Terminal window
gcloud beta network-connectivity transports delete "$TRANSPORT_NAME" \
--region="$GCP_REGION" \
--project="$GCP_PROJECT" \
--quiet

Console: AWS Interconnect — set region= to your aws_region. Delete demo-interconnect.

CLI (AWS CLI ≥ 2.34.43):

Terminal window
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.

Do not run terraform destroy while AWS still shows deleting.

Poll until the interconnect list is empty:

Terminal window
aws interconnect list-connections --region "$AWS_REGION" \
--query 'connections[*].{id:id,state:state,description:description}' \
--output table
ResultSafe to proceed?
Empty tableYes

state: deleting

No — wait

state: available

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

Terminal window
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:

Terminal window
terraform destroy

Remove the GCE key files saved in Step 7:

Terminal window
rm -f demo-gce-key demo-gce-key.pub