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.
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.