EC2实例不断被ECS容器服务启动

huangapple go评论62阅读模式
英文:

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.
EC2实例不断被ECS容器服务启动

Please help. I am at my wits end.

  • What is the proper way of terminating an ECS cluster and task? Did I do something wrong?
  • Has anyone experienced EC2 Instances being recreated even after the Task is deleted?!
  • Any advice here?
英文:

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.
EC2实例不断被ECS容器服务启动

Please help. I am at my wits end.

  • What is the proper way of terminating a ECS cluster and task? Did I do
    something wrong?
  • Has anyone experienced EC2 Instances being recreated even after the Task is deleted?!
  • Any advice here?

答案1

得分: 1

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.

https://stackoverflow.com/questions/32684752/unable-to-delete-ec2-instance-for-ecsec2-container-service?rq=2

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.

英文:

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.

https://stackoverflow.com/questions/32684752/unable-to-delete-ec2-instance-for-ecsec2-container-service?rq=2

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.

huangapple
  • 本文由 发表于 2023年4月11日 00:37:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/75978899.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定