How can the user achieve this?
The user can the set DisableApiTermination attribute to avoid accidental termination
It is not possible to avoid accidental termination
The user can set the Deletion termination flag to avoid accidental termination
The user can set the InstanceInitiatedShutdownBehavior flag to avoid accidental termination
Explanations:
Setting the DisableApiTermination attribute to true on an EC2 instance prevents the instance from being terminated via API calls, thus protecting it from accidental termination by the production team. This attribute can be configured during instance creation or modified afterward.
It is indeed possible to avoid accidental termination by using the DisableApiTermination attribute, so stating that it is not possible is incorrect.
There is no “Deletion termination flag” in AWS EC2. The correct attribute to prevent accidental termination is the DisableApiTermination attribute.
The InstanceInitiatedShutdownBehavior flag determines how an instance behaves when it is shut down from the operating system, not how it can be protected from termination. It does not prevent accidental termination via the AWS Management Console or API.