How do I protect my data against accidental EC2 instance termination?

2 minute read

I want to know what options AWS offers that can help me protect my data against accidental Amazon Elastic Compute Cloud (Amazon EC2) instance termination. I also want to troubleshoot and collect more information about probable termination causes and behaviors.


To help protect against data loss caused by accidental termination of an Amazon EC2 instance, consider the following options when you configure EC2 infrastructure:

  • Turn on termination protection. Termination protection prevents an instance from accidental termination. By default, this option is turned off for EC2 instances. Turn on this option to protect your instance from any unintentional termination. For more information, see Turn on termination protection.
  • Regularly back up your data. Back up your instance by doing one or more of the following:
    Create an Amazon Machine Image (AMI). An AMI can capture the data on all the EBS volumes attached to an instance. You can use the AMI to launch a new instance.
    Schedule regular Amazon Elastic Block Store (Amazon EBS) snapshots.
    Use AWS Backup.
  • Output data to another AWS service or source. Consider using one of the following services to store the workflows you run on your instance:
    Amazon Simple Storage Service (Amazon S3)
    Amazon Relational Database Service (Amazon RDS)
    Amazon DynamoDB
  • Recreate your instance or restore data from a terminated instance. If you backed up your instances, then you can use the backup to restore the terminated instance. For more information, see How do I re-create a terminated EC2 instance?
  • Troubleshoot termination behaviors to identify the causes of termination. Several issue can cause your instance to terminate immediately on start-up. Or, your instance configuration might lead to instance termination. For more information, see Troubleshoot instance termination (shutting down) and Why did Amazon EC2 terminate my instance?

Related information

Best practices for Amazon EC2

Best practices for Windows on Amazon EC2

AWS OFFICIALUpdated 3 years ago