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?
Some services allow you to automatically launch instances to replace terminated instances. This can improve the fault tolerance of an application.
- You can configure your Amazon EC2 Auto Scaling groups to launch an instance that replaces an instance that's undergoing maintenance.
- AWS Elastic Beanstalk environments usually include Auto Scaling groups by default.
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
- Note the instance ID of the instance that re-launched.
- 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.
- Choose Actions, Delete.
- Select Yes, delete.
- Select Instances from the left navigation pane. The instance is terminated and a new instance doesn't launch.
Terminate the Elastic Beanstalk environment
- 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.
- Select Environments, and then choose the name of your environment from the list.
- Verify that the name of the re-launched EC2 instance is the same as the Elastic Beanstalk environment.
- Choose Environment actions, and then choose Terminate environment.
- Confirm the environment termination. It might take a few minutes for Elastic Beanstalk to terminate the AWS resources running in the environment.