Skip to content

How do I recreate or recover a terminated Amazon EC2 instance?

3 minute read
0

My Amazon Elastic Compute Cloud (Amazon EC2) instance was terminated, but I want to recover or restore data from that EC2 instance.

Resolution

Restore your instance

As part of instance termination, Amazon EC2 deletes the data on the instance store volumes and the root Amazon Elastic Block Store (Amazon EBS) volume.

You can't recover the original instance or volumes that Amazon EC2 deleted as part of the termination process. Instead, you must use one of the following methods to recreate the terminated instance:

Prevent future instance or volume deletion

Update your instance settings

Take the following actions:

Create frequent backups of your instance

Important: Don't store critical data on instance store volumes.

Create frequent Amazon EBS-backed AMIs to capture the instance's configuration, such as its operating system (OS), software, settings, and block device mappings. Also, create snapshots of your volumes to capture a point-in-time backup of your volume's data. Make sure that your file system is in a consistent state before you create the snapshot.

To schedule daily incremental snapshots with automated retention policies, use Amazon Data Lifecycle Manager. Or, use AWS Backup plans to back up your AWS resources and backup policies to manage backup plans across AWS accounts and AWS Regions. You can also use Amazon Data Lifecycle Manager and AWS Backup to manage AMIs.

Restrict access to instance termination actions

Use AWS Identity and Access Management (IAM) policies and service controls policies (SCPs) to restrict access to the following actions:

  • ec2:TerminateInstances
  • ec2:DeleteVolume
  • ec2:DeregisterImage

Apply the principle of least privilege so that only users that must take those actions can access them.

Related information

How do I recover an accidentally deleted AMI?

My Spot Instance was terminated. Can I recover it?

How do I protect my data against accidental Amazon EC2 instance termination?

Amazon EC2 backup and recovery with snapshots and AMIs

Create an Amazon EBS-backed AMI

AWS OFFICIALUpdated 6 months ago