AWS EC2: Preventing accidental server termination

Accidental termination usually occurs when one is still new to AWS EC2 and mistakes termination with shutting down. (See this post for a summary of the EC2 server instance lifecycle). It may sound trivial but it can be a painful mistake - once terminated neither the operating system, nor software, nor data can be recovered - everything is flushed down the bit black hole.

There are 2 options that can save you from donating your hard work to oblivion.

1. Set Termination Protection On
With termination protection on a server cannot be terminated but can be shut down. You must turn off termination protection to terminate the instance. Termination protection can be set up during or after server instantiation.

Enable termination when configuring the EC2 instance

2. Disable the Volume Delete on Termination Option
Where you have critical information on your attached root volume, you may want to disable the option to delete the root volume when the server is terminated. This option is automatically on at the "Add Storage" stage when when instantiating a server.

Uncheck "delete on termination" for protection from accidental termination

This means that even if a server is mistakenly terminated, the operating system and data are still available and can be used to rebuild the server. However, remember to manually delete any volumes you are not using since they continue to be billed per GB-month.


Post a Comment