Can I delete original EC2 instance after creating an image out of it?

4.4k Views Asked by At

I've setup a EC2 instance with EBS root. As part of the process, the system has created a snapshot of its EBS volume. My doubt is what happens when I remove the EC2 instance (and its EBS volume).

After deleting the EBS volume, will the snapshot still have the full copy of my system? Will I be able to restore a copy of my system in future out of the AMI?

Thanks

2

There are 2 best solutions below

1
On BEST ANSWER

If you create an AMI from an EC2 instance, you can terminate the instance and create a new one from the AMI.

If you have taken a snapshot of the EBS boot volume the instances is using, you will need to register it as an AMI before you can create a new instance.

If you take a snapshot of a volume, and then delete the original volume, you can recreate the volume from the snapshot even if the original volume is deleted.

0
On

Here's Amazon's default termination behaviors for EBS-backed instances:

By default, the root device volume and the other Amazon EBS volumes attached when you launch an Amazon EBS-backed instance are automatically deleted when the instance terminates. For information about how to change this behavior when you launch an instance, see Changing the Root Device Volume to Persist.

By default, any Amazon EBS volumes that you attach to a running instance are detached with their data intact when the instance terminates. You can attach a detached volume to any running instance.

If you create an AMI from your EBS-backed instance, a separate volume will be created when you launch a new instance based on that AMI with your data persisted from the time of the last snapshot of that volume.

More info about Root Device Storage