How To Delete Instance In AWS

How To Delete Instance In AWS

When you have created many instances in AWS and have not used a few for a long time, it is time to clean up and delete the instance from AWS. It’s quite easy, and you need to perform a few quick steps to delete an instance in AWS. An important point to remember here is when you are terminating an instance, you won’t be able to reconnect it once terminated. Once you terminate an instance, it just takes a very short time to delete it automatically.

This AWS tutorial will discuss how to delete an instance in AWS and a few related FAQs.

How To Delete An Instance In AWS

Follow the below steps to delete the Terminated Instance In AWS quickly.

  1. Locate the instance you wish to delete or terminate on the Instances page in the Amazon EC2 console.
  2. Right-click on the instance, from the menu, choose Instance State –> Select Terminate option.
  3. Finally, on the next confirmation pop-up, choose Yes to confirm the termination of the AWS instance.

Once you have terminated the AWS instance, it will take a very short period to completely delete it from the AWS console.

How to delete terminated EC2 instance using the AWS Management Console

You can easily terminate an AWS instance using the AWS management console following the below quick steps.

  1. The first step is to back up your data before terminating the AWS instance. Otherwise, you are going to lose your data.
  2. Navigate to the Amazon EC2 console (
  3. Choose the Instances option in the navigation pane.
  4. Now, choose the Instance state, Terminate instance.
  5. Finally, you will get a confirmation pop-up now. Select the Terminate option for the confirmation.

You can also able to terminate an instance using the AWS CLI.

How to delete an EC2 instance using AWS CLI

You can follow the below quick information to terminate an instance using the AWS CLI.

You can specify the specific instances that you want to terminate.


The syntax of the AWS CLI cmdlet to terminate the instance

--instance-ids <value>
 [--dry-run | --no-dry-run]
 [--cli-input-json <value>]
[--generate-cli-skeleton <value>]

You can provide up to 1000 instance IDs with the AWS CLI cmdlets. But the suggestion here is to run with small batches.

Let’s consider the below example that terminates a specific instance with the specified ID.


You can execute the below AWS CLI cmdlet with the correct instance ID.

aws ec2 terminate-instances --instance-ids i-573790123yhjiuikl

You will get the output below once you execute the AWS CLI cmdlet above.

    "TerminatingInstances": [
            "InstanceId": "i-573790123yhjiuikl",
            "CurrentState": {
                "Code": 32,
                "Name": "shutting-down"
            "PreviousState": {
                "Code": 16,
                "Name": "running"


How long do terminated instances stay in AWS?

Once you terminate the instance in AWS, it stays for 1 hour approximately, and then it gets deleted permanently.

How do I reset a terminated instance?

It’s not possible to reset a terminated instance in AWS. Once you have terminated the instance, you can’t use that instance anymore and must create a new one.

Can we recover the terminated EC2 instance?

it’s impossible to recover a terminated EC2 instance. Also, you won’t be able to recover the data you might have stored locally.

What is the difference between terminating and stopping an AWS EC2 instance?

When using an AWS EC2 instance, you can stop and terminate the AWS EC2 instance.

Either you stop the AWS EC2 instance or you terminate the instance. In both cases, the instance will shut down, and the VM will be removed permanently, and you will not need to pay for the usage.

Let’s discuss the key differences between stopping and terminating the AWS EC2 instance.

Terminating AWS EC2 InstanceThe data on your EBS volume will not be available after terminating.
The attached bootable EBS volume will get deleted.The attached bootable EBS volume will not get deleted.
The data on your EBS volume will not available after terminating.The data on your EBS volume will remain as it is after stopping.

Note: An important point to note here is if you plan to start the AWS EC2 instance again, you should stop the AWS EC2 instance instead of terminating it.

Who deleted the AWS EC2 instance?

Suppose you are surprised to see the deletion of any specific AWS EC2 instance and wish to know who has deleted that instance. By accessing the Amazon CloudTrail, you will know who is responsible for deleting the AWS EC2 instance.

How do I know who stopped the AWS EC2 instance?

With the help of Amazon CloudTrail, We can know who has stopped the AWS EC2 instance. Follow the below steps.

  1. Open the Amazon CloudTrail console and choose Event History from the navigation pane.
  2. Select the Event name from the Lookup attributes dropdown menu.
  3. Now is the time to enter the event name. You need to enter the event name based on the event. For example, enter the event name as “StopInstances” if your instance was stopped. If your instance was terminated, enter the event name as “TerminateInstances.”
  4. On the event details page, choose the event name as StopInstances or TerminateInstances. Now, you can see the name of the AWS Identity and IAM user who initiated the event.

Wrapping Up

This article discussed how to delete instances in AWS and a few related FAQs.