EC2 Shutdown Behavior, Hibernate, and Termination Protection
Explore EC2 shutdown behaviors including stopping and terminating instances through in-instance commands. Understand termination and stop protections designed to prevent accidental deletions via console or CLI. Learn how EC2 hibernation preserves RAM state to speed up restart times and the requirements needed to enable it on EBS-backed instances.
Shutdown behavior
The shutdown behavior parameter specifies what should happen to our EC2 instance if it shuts down. The default value for shutdown behavior is to stop the instance. However, we can set this behavior to “terminate.”
This option isn’t applicable when we shut down (stop) the instance from the console. It’s only applicable when we shut down from within the EC2 instance by using a command such as shutdown or poweroff.
We can change this behavior using the InstanceInitiatedShutdownBehavior attribute in the AWS CLI. The shutdown behavior of the instance can be changed while the instance is stopped or running. ...