Removing a VM with associated snapshots, volumes and AMI

From Notes_Wiki

Home > Amazon web services > Removing a VM with associated snapshots, volumes and AMI

To remove a VM properly with its associated snapshots, volumes, AMI, etc. use following steps:

  1. Login into AWS EC2 web console
  2. Determine the name of the VM to be deleted.
  3. Click on the VM and determine its instance ID. Also note name of its volumes under "Storage" along with volume IDs. Copy these instance IDs and volume names to a temporary location (Notepad / excel file for future reference during the deletion process).
  4. Poweroff or shutdown the VM, if it is running.
  5. If the process requires to have a latest AMI for a few days for safety/fall back purposes then right click on the VM and create image
  6. Go to AMI section under EC2 using left panel menu. For the AMI being created give appropriate name.
  7. Search for other AMI for the same instance using instance ID. Deregister all other AMIs' except the last one being created as part of deletion process.
  8. Go to snapshots. For the new snapshots (One per volume) being created, give appropriate name.
  9. Search for other snapshots of the VM using volume IDs captured earlier. Delete all snapshots except the last one being created.
  10. Go to AMI section and see that latest AMI is created sucessfully and is available. Validate that assocated snapshots are not deleted accidentally (Actually we will get error even if try to delete snapshot associated with an AMI that is not de-registered).
  11. Once latest AMI is created successfully go to VM and try to terminate it. If you get error remove its termination protection and try to terminate it again.
  12. Go to volumes and search for volume IDs noted earlier. If the volumes are not configured to delete automatically on VM deletion they would still be present but state would be available instead of used. In this case right click on these volumes and delete them.



Home > Amazon web services > Removing a VM with associated snapshots, volumes and AMI