Prevent accidental termination of a virtual machine in AWS

Posted by
daniel

Nov
14

Amazon provides extensive tools to manage virtual machines hosted on Amazon web services(AWS). It is very easy to launch VMs, and a lot easier to destroy or terminate VMs! It might be unintentional in the later case, with just one mis-click and a second confirmation you could end up terminating a critical production server. There is now way of bringing back a terminated VM in AWS. Once it is gone, it is gone forever.

So what steps should you follow to prevent unintended data loss?

1. Make sure the virtual machines are properly labelled in the EC2 dashboard – under “Name”. This can be done by simply right clicking a VM, and selecting “Add/Edit Tags”. If you have so many servers without proper tags, you might unintentionally terminate the wrong server.

2. Enable Termination Protection – Right click on the VM and select “Termination Protection”. Make sure the Termination protection is Enabled. If by any chance you decide to terminate your VM, you have to disable the termination protection on this option, and then go back to the dashboard to terminate your VM.