To delete terminated EC2 Instances, locate the instance you want to delete in the EC2 Console under the Instances page. Click on the instance and select the Terminate option. Once you’ve selected “terminate,” you will receive a pop-up confirmation. Click “yes” to confirm. You can also terminate an EC2 Instance using a command line or an API.
The instance will remain on the AWS console for about an hour before the system deletes it completely. After you terminate an instance, you will also delete all attached Amazon EBS volumes. However, any volumes attached after you launched the instance will persist. It is essential to back up the data before terminating the instance.
Terminating vs. Stopping an Instance
You can either terminate or stop an instance from running. Terminating or stopping an instance ensures it does not accrue more charges. In both, the instance will shut down, and the virtual machines will disappear.
Unlike a terminated instance, you can restart a stopped one. If you want to use an instance later, you should stop it rather than terminate it.
When stopping an instance, EBS volume will remain. The attached bootable EBS volume will remain as well. The volume will continue persisting in its availability zone and will incur standard charges. It is a good idea to stop any instances that you will continue using within a short period. Unless you plan to start an instance within a short time, you should terminate it to avoid any unnecessary charges.
Can I Restart a Terminated Instance?
Once you have terminated an instance, you cannot restart it. You must create a new one. Also, you cannot recover the data associated with the terminated instance.
Protect EC2 Instances from Termination
Since you cannot restart a terminated instance, protecting your instances from accidental termination is essential. This saves you from losing resources and crucial data.
Here are some handy ways to prevent EC2 Instance termination:
AWS Termination Protection
You can enable AWS termination protection to prevent accidental deletion. The DisableApiTermination attribute is responsible for preventing accidental deletion. However, you cannot protect the termination of Spot Instances. Spot Instances will automatically terminate after you have exceeded the agreed-upon price.
To enable this protection at launch time, open “Launch Instance” under the Amazon EC2 console. Then, configure the instance details and check the “Enable Termination Protection” box.
You can enable termination protection under the Instance Settings on the Actions page for running and stopping instances. You can disable this protection anytime through the Instance Settings.
Identity and Access Management (IAM)
Since cloud security is a shared model, it’s your responsibility to protect cloud resources. Ensure you have the right access policies so anyone who doesn’t have permission cannot terminate instances.
Manage EC2 Instances with nOps
The nOps cloud management platform is streamlined with the AWS Well-Architected Framework to help you manage your AWS cloud resources. nOps allows you to effectively monitor your instances and save a lot on costs.
Start your nOps free trial today!