KJ Ang
KJ Ang

Reputation: 658

EC2 instance keeps getting started by ECS ContainerService

I am trying to deploy a docker image with ECS, EC2.

The first part, pushing my docker image to ECR, was smooth sailing.

Then, I created one Task and one ECS cluster. My Task was set to use EC2 with 800Mb memory requirement and 1 vCPU, and I also entered my docker ECR container uri. After creating, an EC2 instance was created and it was working!

But then, my nightmare began. I wanted to shut this ECS cluster/task and its EC2 down. So, I went to the ECS console and deleted my Cluster and then deregistered my Task. I went to EC2 console and terminated its instance. But after a few minutes, the EC2 that I just terminated respawned! For two hours, I tried repeatedly to terminate this EC2 instance but the demonic EC2 instance kept respawning!

The last thing I tried: I found the delete feature on the Task page on ECS and deleted the Task, but this still did not work!

Here is an snippet of the EC2 instance I kept on terminating. enter image description here

Please help. I am at my wits end.

Upvotes: 0

Views: 90

Answers (1)

KJ Ang
KJ Ang

Reputation: 658

I have found another question on Stackoverflow that answered my problem! It was nothing got to do with ECS. It was because of the Autoscaling groups that was somehow created by ECS.

Unable to delete EC2 instance for ECS(EC2 Container Service)

Thank you!

A copy of @Michael - sqlbot's answer

Note

If your instance is maintained by an Auto Scaling group or AWS CloudFormation stack, terminate the instance by updating the Auto Scaling group or AWS CloudFormation stack; otherwise, the Auto Scaling group will recreate the instance after you terminate it.

http://docs.aws.amazon.com/AmazonECS/latest/developerguide/deregister_container_instance.html

Auto Scaling groups can be found in the the EC2 console navigation pane: under Auto Scaling, click Auto Scaling Group.

Upvotes: 1

Related Questions