0

I had an ECS cluster, service, task definitions, ECR repo, RDS database, security groups, and other EC2 services, and I managed to delete all except for a single task definition and the associated network and VPC services. I can't delete any network and other VPC services before the task definition is deleted. However, the task definition is stuck on DELETE_IN_PROGRESS.

I deleted the stacks in CloudFormation but it didn't help. CloudTrails don't show any errors either. The task definition had a task role and task execution role but both are deleted. It had one container but the ECR repo had been deleted as well. I tried using AWS CLI and some --force commands to delete other associated services but none could be deleted before this task gets deleted.

Here is a list of services I checked:

Running services:

  • EC2 Security Groups - 1
  • EC2 VPCs - 1
  • Subnets - 2
  • Route Tables - 1
  • Security Groups - 1
  • Network ACLs - 1

No running services:

  • EC2 Instances
  • EC2 Key Pairs
  • EC2 Elastic IPs
  • EC2 Instances
  • RDS Instances
  • ECS Clusters
  • ECS Task Definitions
  • ECR Repositories
  • Lambda Functions
  • S3 Buckets

Basically, I want to delete all services. Any suggestions on how to do it?

Martin
  • 1
  • 2
  • Are you sure there isn't some ECS stuff still running? The Task Definition itself is just like a static file sitting there, it's not a running process, and it doesn't have active VPC connections. A task definition by itself shouldn't be preventing you from deleting the VPC. If you try to delete the VPC from the AWS console, it should give you an error message in the UI with a list of resources that need to be deleted first. – Mark B May 03 '23 at 15:03
  • Updated question above. When I try to delete the VPC I get `VPC contains one or more in-use network interfaces`. When I try to detach the network interface with or without force I get `Failed to detach the network interface. API error: "You do not have permission to access the specified resource."` even though I am with the root user, it somehow tries to detach it with the IAM. When I try to delete it, I get `The network interface can't be deleted. Network interface is currently in use.` – Martin May 03 '23 at 16:13
  • ECS Task Definitions are just definitions used to create tasks. They do not have network interfaces attached to them. You need to go find what you have running in your VPC still. – Mark B May 03 '23 at 16:54

0 Answers0