In order to protect data against Accidental EC2 Instance Termination, we can enable termination protection.
Here, at Bobcares, we assist our customers with several AWS queries as part of our AWS Support Services.
Today, let us see how we can help protect against data loss by accidental termination.
Protect Data Against Accidental EC2 Instance Termination
In order to help protect against data loss our Support Techs recommend the following options when we configure EC2 infrastructure:
- Enable termination protection.
This prevents an instance from accidental termination. By default, this option will be disabled for EC2 instances. So we need to enable it to protect from any unintentional termination.
- Regularly back up the data.
A backup is always a good idea. We can perform the backup via one or more of the following:
a) We can create an Amazon Machine Image (AMI). It will capture the data on all the EBS volumes attached to an instance and can launch a new instance.
b) Schedule regular Amazon Elastic Block Store (Amazon EBS) snapshots.
c) Or, use AWS Backup.
- Output data to another AWS service or source.
To store the workflows we run on the instance, we can use one of the following:
a) Amazon Simple Storage Service (Amazon S3)
b) Amazon Relational Database Service (Amazon RDS)
c) Amazon DynamoDB
- Recreate the instance or restore data from a terminated instance.
If we back up the instances, then we can use it to restore the terminated instance.
We need to troubleshoot termination behaviors to identify the causes of termination.
Enable termination protection
By default, we can terminate the instance via the Amazon EC2 console, command-line interface, or API.
Enable termination protection for an instance at launch time:
- Initially, we open the Amazon EC2 console.
- Then on the dashboard, we select Launch Instance and follow the directions in the wizard.
- On the Configure Instance Details page, we select the Enable termination protection check box.
Enable termination protection for a running or stopped instance:
- Here, we select the instance > Actions > Instance Settings > Change Termination Protection.
- Eventually, we select Yes, Enable.
Disable termination protection for a running or stopped instance:
- Initially, we go to the instance > Actions > Instance Settings > Change Termination Protection.
- Then, we select Yes, Disable.
[Need help with the process? We’d be happy to assist]
To conclude, we saw how our Support Techs fix the accidental EC2 instance termination query for our customers.