Getting Started on AWSLanding zone and Amazon ECS on EC2 · live course guide
Home

Chapter 11 of 12

LIVE BUILD

Step 6, clean up

  1. Step 6. Clean up

    Delete in this order, so nothing is left running:

    1. Service course-web-svc: set desired tasks to 0, then Delete service.
    2. EC2, Load balancers: delete course-web-alb. Target groups: delete course-web-tg.
    3. Cluster course-demo: Delete cluster. Then open CloudFormation and check that the stack whose name starts with Infra-ECS-Cluster-course-demo is gone. If it is still there, delete it: it holds the Auto Scaling group and the EC2 instances, which keep running (and billing) until it is gone.
    4. VPC, NAT gateways: delete the NAT gateway and wait until it shows Deleted. Then Elastic IPs: release the address it used.
    5. VPC, Your VPCs: select course-vpc, Delete VPC. The console also deletes the subnets, internet gateway, route tables, S3 gateway endpoint and security groups in it. Instances, the load balancer and the NAT gateway have to be gone first, which is why this step comes last.
    6. Task definition course-web: deregister revision 1. CloudWatch Logs: delete the /ecs/course-web log group.

    The two IAM roles the wizards created, ecsInstanceRole and ecsTaskExecutionRole, can stay. They cost nothing and the next build reuses them.