Skip to content

Teardown

When you are finished exploring the demo, remove all provisioned resources by running terraform destroy. This tears down the Express Gateway Service
The aws_ecs_express_gateway_service Terraform resource that provisions an ECS service with managed ALB, auto scaling, and simplified configuration for HTTP/HTTPS web applications and APIs.
, the Shared ALB
The Application Load Balancer shared by up to 25 Express services in the same VPC using Host header routing rules.
, networking components, IAM roles, and the ECS cluster in the correct dependency order.

Terminal window
terraform destroy

Terraform prompts for confirmation before proceeding. Type yes to confirm. The destroy operation removes resources in reverse dependency order — the Express Gateway Service and its managed ALB are removed first, followed by IAM roles, security groups, subnets, and the VPC
Virtual Private Cloud — an isolated virtual network within AWS where resources are deployed.
.

After terraform destroy completes, confirm Terraform no longer tracks any resources:

Terminal window
terraform state list

The command should produce no output. If any resources are listed, run terraform destroy again to remove them.

If terraform destroy fails or hangs, common causes include:

SymptomCauseResolution
Timeout waiting for ALB deletionActive connections drainingWait for drain to complete or manually deregister targets
VPC deletion failsDependent resources still exist (ENIs, security group references)Remove dependent resources first, then retry destroy
IAM role deletion failsRole still attached to running tasksStop all tasks in the cluster, then retry destroy