Question

 

I accidentally terminated the EC2 instance in progress.

Can I restore the EC2 instance that was terminated?

 

 

Answer

 

When you terminate an Amazon EC2 instance, the data on the instance store volumes associated with the instance is deleted as part of the termination operation.

Also, the root volume of that instance is set to its default value to be deleted.

 

*  What is instance store volume?

An instance store provides temporary block-level storage for your instance. This storage is located on disks that are physically attached to the host computer.


 

Data stored on instance store volumes is ideal as temporary storage because it does not provide permanence against instance stops, terminations, or hardware failures.
 

# Amazon EC2 instance store -

https://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/InstanceStorage.html

 

 

* Root volume Deletion

By default, the DeleteOnTermination attribute for the root volume of an instance is set to true. Therefore, root volume of the instance is deleted when the instance is terminated.


 

# Preserve Amazon EBS volumes on instance termination -

https://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/terminating-instances.html#preserving-volumes-on-termination

 

 

 

You cannot restore a closed original Amazon EC2 instance or deleted volume.

However, you can recreate the terminated instance as a new instance in two ways below:

 

 

  • Launch a replacement EC2 instance using Amazon EBS snapshots or Amazon Machine Images (AMI) backups that were created from the terminated Amazon EC2 instance.
  • Attach an EBS volume from the terminated instance to another EC2 instance. You can then access the data contained in those volumes.

 

 

In addition to regularly creating snapshots and AMIs to back up sensitive data, you may want to consider using shutdown protection to prevent this issue in the future.

 

 

You can also automate snapshots using Amazon DML(Amazon Data LifeCycle Manager) and AWS Backup.

 

 

# How to re-create or restore a terminated Amazon EC2 instance? -

https://aws.amazon.com/ko/premiumsupport/knowledge-center/recovery-terminated-instance/