Can't stop my AWS EC2 instance properly

这一生的挚爱 提交于 2020-01-13 16:54:05

问题


Newbie to AWS, I have a t2.micro EC2 instance supporting my Elastic Beanstalk application. It was created while I deployed my WAR file to Elastic Beanstalk.

My EB application does not need to run 24 hrs a day so it only needs to work during a specific period of time a day. When I tried to stop it from the AWS EC2 management console by selecting "Actions -> Instance state -> Stop", the instance was terminated instead but a new instance was created and initialized and then running automatically later.

How can I stop an EC2 instance properly to suit my need? Thanks.


回答1:


Your EB application is utilizing an Auto Scaling group to ensure your EC2 instance stays running.

When you stop your EC2 instance, Auto Scaling sees that as an unhealthy instance and terminates it, then replaces it with a new, healthy instance.

You cannot stop EC2 instances that are part of an Auto Scaling group. The best you can do is to edit your Auto Scaling group policy to set min=desired=0. This will terminate the instance and keep it terminated. When you want to get your instance running again, edit your Auto Scaling group and reset min=desired=1.



来源:https://stackoverflow.com/questions/35916144/cant-stop-my-aws-ec2-instance-properly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!