Search code examples
ruby-on-railsruby-on-rails-4amazon-web-servicesamazon-ec2ec2-api-tools

Deleting EC2 Instance Causes Amazon to Magically Restart New One


I have an Amazon AWS account with several instances. One of these instances I thought I deleted. However, I just checked my dashboard and it's still there. When I go to the dashboard and successfully terminate the instance, Amazon AWS automatically creates a new instance with the same instance. If I stop the instance then the instance will terminate on it's own and a new one is created. I have not done any customization to Amazon to lead to anything like this. Has anyone else experienced this? Am I missing something?


Solution

  • You say you haven't done any customization to cause this to happen, but the most likely cause is that the instance is part of an autoscaling group, and the termination of the instance causes AWS to spinup another one because you have sunk below the minimum group size that was defined.

    Are you sure you (or someone else) hasn't inadvertently started/included this instance within an ASG?

    Some reading: http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/attach-instance-asg.html

    and how to detach from an ASG: http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/detach-instance-asg.html