Why did an EC2 instance that I terminated automatically re-launch?

Last updated: 2021-02-24

I terminated an Amazon Elastic Compute Cloud (Amazon EC2) instance. Then, another instance of the same type automatically launched on my account. Why did this happen, and how can I stop new instances from re-launching?

Short description

Some services allow you to automatically launch instances to replace terminated instances. This can improve the fault tolerance of an application.

For example:

To prevent replacement instances from launching, delete the Auto Scaling group or terminate the Elastic Beanstalk environment.

Resolution

Note: The following actions permanently delete the selected AWS resources. Create a backup of your EC2 instance before proceeding with this resolution. The backup allows you to revert to your previous working state, if necessary.

Delete the Auto Scaling group

  1. Note the instance ID of the instance that re-launched.
  2. Confirm which Auto Scaling group is causing the re-launch.
    Open the Amazon EC2 console. Amazon EC2 resources are Region-specific. Be sure that you're in the correct Region. If not, choose the correct Region from the navigation bar at the top of the screen.
    Choose Auto Scaling groups in the left navigation pane and open it in a new window.
    Choose the Auto Scaling group, and then select the Activity History tab.
    Verify the instance ID of the re-launched instance.
    Note: If instance ID doesn't match or you have no Auto Scaling groups in this Region, skip to the following Terminate the Elastic Beanstalk Environment section.
  3. Choose Actions, Delete.
  4. Select Yes, delete.
  5. Select Instances from the left navigation pane. The instance is terminated and a new instance doesn't launch.

Terminate the Elastic Beanstalk environment

  1. Open the AWS Elastic Beanstalk console. Amazon EC2 resources are Region-specific. Be sure that you're in the correct Region, if not, choose the correct Region from the navigation bar at the top of the screen.
  2. Select Environments, and then choose the name of your environment from the list.
  3. Verify that the name of the re-launched EC2 instance is the same as the Elastic Beanstalk environment.
  4. Choose Environment actions, and then choose Terminate environment.
  5. Confirm the environment termination. It might take a few minutes for Elastic Beanstalk to terminate the AWS resources running in the environment.

Did this article help?


Do you need billing or technical support?