Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recover terminated EC2 Instance

Tags:

amazon-ec2

title says it all. I inadvertently terminated an EC2 Instance and desperately need to restart it/relaunch it!!! Any help? It would be disastrous if I had to start all over!! Does anyone know how I can fix this?

like image 570
Spade Johnsson Avatar asked Oct 18 '16 08:10

Spade Johnsson


People also ask

Can I recover terminated EC2 instance?

It's not possible to recover either the original Amazon EC2 instance or any volumes that were deleted as part of the termination process.

How long does terminated EC2 instance stay?

Terminated instances remain visible after termination (for approximately one hour). By default, Amazon EC2 deletes all EBS volumes that were attached when the instance launched. Volumes attached after instance launch continue running. You can stop, start, and terminate EBS-backed instances.

How do I find my terminated EC2 instances?

Open the CloudTrail console. Choose Event history. Select Event Name in the Filter dropdown list, and then enter TerminateInstances to view all instance termination API calls.

What happens when EC2 instance is terminated?

After you terminate an instance, it remains visible in the console for a short while, and then the entry is automatically deleted. You cannot delete the terminated instance entry yourself.


1 Answers

Basically it goes like this:

  • Your machine is gone, you cannot restart, you need to create a new instance
  • all the data you had on an instance store volume are gone (you cannot recover those)
  • If you had EBS Volume attached and you had setting enable for 'delete on termination' the latest data are gone. You can recover if you have a snapshot from this volume.
  • If you had EBS Volume attached without flag for 'delete on termination' you can recover those data

So what you can do:

  • check your snapshots and Volumes in the ec2 console. If you have no snapshot/volumes, you cannot recover anything
  • if you have root volumes,
    • make a snapshot of those you want to recover
    • from the snapshot, make an image
    • from the ami, launch a new instance for the specific image you've just created
  • if you dont have root volumes
    • create volumes from snapshot if you have any snapshot you need to recover data
    • create a new ec2 instance
    • attach and mount the volumes to the new instance
    • read and backup your data
like image 177
Frederic Henri Avatar answered Oct 20 '22 09:10

Frederic Henri