Skip to content

Why did an Amazon EC2 instance that I terminated automatically relaunch?

3 minute read
0

I terminated an Amazon Elastic Compute Cloud (Amazon EC2) instance. Then, another EC2 instance of the same type automatically launched on my AWS account.

Short description

To improve the fault tolerance of your application, you can configure AWS services to automatically launch instances to replace terminated instances. The configurations have AWS services automatically launch instances:

To make sure that the AWS services don't launch replacement instances, take the following actions.

Resolution

Important: The following resolution steps permanently delete the AWS resources. It's a best practice to create an Amazon Machine Image (AMI) of your instance or a snapshot of your instance's Amazon Elastic Block Store (Amazon EBS) volume. If you experience issues, then you can use the backup to restore your instance.

Check the relaunched instance ID

Open the Amazon EC2 console. In the navigation pane, choose Instances, and then note the instance ID of the instance that relaunched.

Note: Amazon EC2 instances are specific to AWS Regions. Make sure that you check the correct Region.

Delete the Auto Scaling group

Complete the following steps:

  1. Open the Amazon EC2 console.
  2. In the navigation pane, choose Auto Scaling groups, and then choose the Activity history tab.
  3. If you see the instance ID of the instance that relaunched, then delete the Auto Scaling group.

Terminate the Elastic Beanstalk environment

Complete the following steps:

  1. Open the Elastic Beanstalk console.
  2. Choose Environments, and then choose your environment.
  3. If you see the instance ID of the instance that relaunched in the environment, then terminate the Elastic Beanstalk environment.

Delete the EC2 Fleet

Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.

To check whether you have an existing EC2 Fleet, run the following describe-fleets AWS CLI command:

aws ec2 describe-fleets

Then, run the following describe-fleet-instances command to check whether the EC2 Fleet relaunched the instance:

aws ec2 describe-fleet-instances --fleet-id example-fleet

Note: Replace example-fleet with your EC2 Fleet ID.

If you see the relaunched instance ID in the output, then delete the EC2 Fleet request. If the relaunched instance ID doesn't appear in the output, then the EC2 Fleet didn't launch the instance and you must cancel the Spot Fleet.

Cancel the Spot Fleet

Complete the following steps:

  1. Open the Amazon EC2 console.
  2. In the navigation pane, choose Spot requests.
  3. Choose a Spot Fleet request, and then choose Description.
  4. Choose Instances.
  5. If you see the instance ID of the instance that relaunched, then cancel the Spot Fleet request.
AWS OFFICIALUpdated 8 months ago