šŸ›”ļø AWS 109: The Ultimate Safety Net - Enabling EC2 Termination Protection

Published: (December 20, 2025 at 05:25 AM EST)
4 min read
Source: Dev.to

Source: Dev.to

Cover image for šŸ›”ļø AWS 109: The Ultimate Safety Net - Enabling EC2 Termination Protection

Hritik Raj

AWS

🚫 No Turning Back: Safeguarding Your EC2 from Accidental Deletion

Hey Cloud Guardians! šŸ‘‹

Welcome to Day 9 of the #100DaysOfCloud Challenge: Enable Termination Protection! Yesterday we learned how to prevent a server from being stopped. Today we’re tackling something even more critical: preventing a server from being permanently deleted. Following the roadmap from KodeKloud Engineer, we are securing a vital piece of the Nautilus infrastructure.

Diagram

Our mission: Enable Termination Protection for the instance named xfusion-ec2 in the us-east-1 region.


1. Introduction: What is Termination Protection? šŸ’”

In AWS, ā€œTerminationā€ means the virtual machine is deleted forever and its root volume is usually wiped clean. There is no ā€œUndoā€ button for this!

The Safety Lock: Termination Protection adds a confirmation layer. When enabled, the ā€œTerminateā€ option in the console is greyed‑out or results in an error message.

Why it Matters: For database servers, production APIs, or legacy systems like xfusion-ec2, an accidental termination could mean hours of recovery from backups. This setting ensures that someone must explicitly disable the protection before the instance can be destroyed.

Operational Excellence: In a professional DevOps environment, all critical infrastructure should have this enabled by default to prevent ā€œfat‑fingerā€ errors during maintenance.

Let’s make sure our server stays put! šŸ›”ļø

2. Step‑by‑Step Guide: Protecting the xfusion-ec2 Instance

We will use the AWS Management Console to modify the instance attributes while it’s running.

Step 2.1 – Locate Your Instance

  1. Log in to the AWS Console and navigate to the EC2 Dashboard.

  2. Ensure your region is set to US East (N. Virginia) us-east-1.

    EC2 Dashboard – region selector

    Instances list view

  3. Click ā€œInstances (running)ā€.

    Running instances tab

  4. Find and select the instance named xfusion-ec2.

    Select xfusion‑ec2 instance

Step 2.2 – Modify Termination Protection

  1. With the instance selected, click the ā€œActionsā€ button at the top.

  2. Navigate to ā€œInstance settingsā€ → ā€œChange termination protectionā€.

    Change termination protection menu

  3. In the configuration screen, check the box ā€œEnableā€.

  4. Click ā€œSaveā€.

    Enable termination protection dialog

Step 2.3 – Verify the Protection

While the instance is still selected, try to click ā€œInstance stateā€ → ā€œTerminate instanceā€.

Terminate button disabled or error message

The Terminate button should either be disabled or you will receive an error message such as:

ā€œThe instance i‑xxxxxxxx may not be terminated. Modify its ā€˜disableApiTermination’ instance attribute and try again.ā€

Termination protection in action

Success! Your server is now immune to accidental deletion. šŸŽ‰

šŸŽ‰ Verification (Summary)

  • Return to the Instances list.
  • The ā€œTerminateā€ button for xfusion-ec2 should now be disabled (greyed out).
  • To terminate the instance in the future, repeat the steps above and un‑check the ā€œEnableā€ box.

3. Wrap‑Up

Enabling Termination Protection is a simple yet powerful safeguard that prevents accidental loss of critical workloads. Incorporate this step into your standard operating procedures, and you’ll reduce the risk of costly downtime caused by human error.

3ļøāƒ£ Key Takeaways šŸ“

  • Permanent Safety: Termination protection is the best defense against catastrophic accidental data loss.
  • Granular Control: You can enable it at launch or at any point during the instance’s lifecycle.
  • API Protection: The setting also blocks termination requests coming from the AWS CLI or SDKs, not just the Console.

4ļøāƒ£ Common Mistakes to Avoid 🚫

  • Stop vs. Terminate: Termination Protection does not prevent a user from stopping the instance. Use Stop Protection for that.
  • Auto Scaling Groups (ASG): If the instance belongs to an ASG, termination protection may stop the ASG from scaling down or replacing unhealthy instances.
  • Root Volume Deletion: Even with protection, if you eventually terminate the instance, the attached EBS root volume is usually deleted. Always verify the ā€œDelete on Terminationā€ setting for your EBS volumes.

5ļøāƒ£ Conclusion + Call to Action 🌟

By enabling termination protection, you’ve added a professional‑grade safety guardrail to the xfusion‑ec2 instance. These small configuration steps are what separate a ā€œtest labā€ from a production‑ready cloud environment!

Are you keeping pace with the 100 Days of Cloud Challenge?

šŸ’¬ Let’s connect on LinkedIn:
Hritik Raj – let’s discuss cloud security and operational guardrails!

⭐ Support my journey on GitHub:
GitHub – 100 Days of Cloud

Back to Blog

Related posts

Read more Ā»

EC2 Key Pairs

EC2 Key Pairs - Public key – stored by AWS and placed on the EC2 instance in ~/.ssh/authorized_keys. - Private key – downloaded to your local machine; AWS neve...