1

I'm very new on AWS and now I have two EC2 instances. In order to avoid waste the free tier plan I'm trying to stop instances when I'm not working with them.

This is what my EC2 Management console shows. As you can see there are two instances running and two instances terminated. I did not terminate swipe-dev, I have just stop it. But for any reason now is terminated plus new same instance with same source code was started. Why?

What I'm doing wrong? I just want stop instances.

enter image description here

Edit

I have decide keep just one project so I terminate eb-flask-demo-dev and stop swipe-dev instance. After few minutes instace state was stoped and I thought finally everything is fine. But I rejoin to EC2 console and this is what it shows. Why swipe-dev is running again? and Why there is another terminated instance? enter image description here

1

Your EC2 instances are most likely being created by an Auto Scaling group. If you used Elastic Beanstalk, then this is highly likely.

When Auto Scaling determines that an EC2 instance is "unhealthy", it will terminate the instance and replace it with another. Stopping the EC2 instance will make the instance "unhealthy" in the eyes of Auto Scaling.

So if you are using Auto Scaling, you cannot just stop the instance.

Instead, you can modify the Auto Scaling group's minimum and desired number of instances to be "0". This will have Auto Scaling terminate the existing instances. When you want them back, restore these values to "1" and Auto Scaling will launch new instances for you.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.