I have a couple of small EC2 instances (t1.micro and t2.micro) one of which was setup using AWS-EB. I'd like to terminate both of them, but whenever I terminate them, the re-appear in my list of running instances a couple of minutes later. How do I fully terminate them? Termination protection is not enabled.
As far as I'm aware the configuration wizard for AWS-EB configures an EC2 AutoScaling group for you automatically with a default desired running instances count of 1. That is why every time you try to terminate an instance the instance is relaunched.
I would therefore suggest removing AutoScaling group(s) and probably also load balancer configurations that you no longer need.
These steps will actually be done for you if you terminate the EB application, so there should be no need to do this manually.
Got answer from Amazon Custom Service.
I've researched your account, and the instance is being launched by an active Elastic Beanstalk environment. Terminating the instance will trigger a new one to launch, as each application has by default at least one instance.
If you'd like to delete your environment, follow these instructions:
Log into the Management Console, then select the region your environment is in from the drop-down menu in the upper right of the page. Your environment is located in the US East(Ohio) region.
Navigate to the Elastic Beanstalk Console here:
- Select the environment and choose "Terminate this environment" from the "Actions" menu.
This will delete the Elastic Beanstalk environment, as well as its associated resources. If you'd like help with this, feel free to request a call from us by using the "Phone" contact option on this case.
I hope that helps, but please let me know if you have any other questions.
In some cases, a VPC will act as a wrapper around additional resources. If there is a VPC that was created specifically to hold the, now unwanted, EC2 instances (check the VPC dashboard), the correct move may be to delete that VPC in its entirety.
When attempting to delete the VPC at the AWS console, you will receive notices for resource that must be first closed manually. This should include any EC2 Auto Scaling groups that are maintaining your active instance count.
In other words, attempting to delete the VPC will trigger a guided process of deleting other resources that you might otherwise have left dangling -- including, indirectly, your auto-scaled EC2 instances.
In my case, the VPC had been created by
eksctl and was not automatically removed when I deleted the EKS cluster at the AWS dashboard. Perhaps I should have followed the instructions.