AWS Builder Center: Learn, Build and Connect with builders in the AWS community
AWS Builder Center is the official home for builders on AWS. Share and read what others are working on, follow people who inspire you, explore training and workshops, and find tools to support what you're building.
Best Practices: Create Backups Before Making Changes to Production EC2 Instances
This article outlines best practices for protecting your production workloads and introduces AWS services that automate backup management.
Overview
Many AWS customers experience unrecoverable issues such as kernel panics, GRUB boot failures, or broken configurations after applying patches, OS upgrades, or configuration changes to production EC2 instances without a backup in place. These situations often result in extended downtime and data loss that could have been avoided with a simple EBS snapshot taken before the change.
This article outlines best practices for protecting your production workloads and introduces AWS services that automate backup management.
The Problem Common scenarios where lack of a pre-change backup leads to extended outages:
- Kernel panic after patching – A kernel update renders the instance unable to mount its root filesystem. Without a snapshot, there is no clean state to restore from.
- GRUB boot loader failure – An OS upgrade or manual GRUB configuration change leaves the instance stuck at the GRUB rescue prompt.
- Broken application or system configuration – A change to
/etc/fstab, networking, or security settings prevents the instance from booting or accepting connections.
In each of these cases, recovery without a backup requires manual intervention through rescue instances, which is time-consuming, error-prone, and not always successful.
Best Practice: Always Create a Backup Snapshot Before You Make a Configuration Update/Change
Rule of thumb!! Never apply a change to a production server without creating an EBS snapshot of every attached volume first.
Manual snapshot workflow
Before performing any change (patching, upgrading, configuration modification):
-
Identify all attached EBS volumes for the instance.
-
Create snapshots of each volume: aws ec2 create-snapshot --volume-id vol-0123456789abcdef0 --description "Pre-patch backup 2026-06-24"
-
Wait for snapshot completion before proceeding with the change.
-
Verify the change works correctly.
-
Retain the snapshot for a defined rollback window (e.g., 7 days) before deleting.
Rollback procedure If the change causes a failure:
- Stop the affected instance.
- Detach the failed volume.
- Create a new volume from the pre-change snapshot.
- Attach the restored volume and start the instance.
Automate Backups with AWS Services
Manual snapshots are effective but rely on human discipline. AWS provides two services to automate this process.
Amazon Data Lifecycle Manager (DLM)
DLM automates the creation, retention, and deletion of EBS snapshots on a schedule.
Use DLM when you want to:
- Automatically snapshot EBS volumes on a recurring schedule (e.g., daily, hourly)
- Enforce retention policies (keep the last N snapshots or retain for N days)
- Tag-based targeting (snapshot all volumes with a specific tag)
Getting started:
- Open the EC2 console → Lifecycle Manager → Create lifecycle policy.
- Select "EBS snapshot policy."
- Define target volumes by tag (e.g.,
Backup=true). - Set the schedule (e.g., daily at 02:00 UTC).
- Set retention (e.g., retain 7 snapshots).
Documentation: https://docs.aws.amazon.com/ebs/latest/userguide/snapshot-lifecycle.html
AWS Backup
AWS Backup provides a centralized, fully managed backup service that works across multiple AWS services (EC2, EBS, RDS, EFS, DynamoDB, and more).
Use AWS Backup when you want to:
- Centralize backup management across multiple AWS services
- Define backup plans with rules for frequency, retention, and lifecycle (transition to cold storage)
- Enforce backup compliance with AWS Organizations policies
- Enable cross-region and cross-account backup copies for disaster recovery
- Use backup vaults with access policies for additional security
Getting started:
- Open the AWS Backup console → Create backup plan.
- Choose "Build a new plan" or start from a template.
- Define backup rules (frequency, retention, destination vault).
- Assign resources by tags or resource IDs.
- Optionally enable continuous backup for point-in-time recovery.
Documentation: https://docs.aws.amazon.com/aws-backup/latest/devguide/whatisbackup.html
Comparison: DLM vs. AWS Backup
| Capability | DLM | AWS Backup |
|---|---|---|
| EBS snapshot automation | ✓ | ✓ |
| Multi-service backup (RDS, EFS, etc.) | ✗ | ✓ |
| Centralized management console | ✗ | ✓ |
| Cross-region copy | ✓ | ✓ |
| Cross-account copy | ✓ | ✓ |
| Compliance and audit reporting | Limited | ✓ |
| Cost | No additional charge | Per-GB storage charges |
| Point-in-time recovery | ✗ | ✓ (for supported services) |
Recommendation: Use AWS Backup for comprehensive, centralized backup management. Use DLM if your needs are limited to simple EBS snapshot scheduling.
Additional Recommendations
- Test your backups – Periodically restore from a snapshot to verify the backup is usable.
- Tag your resources – Use consistent tags (e.g.,
Environment=Production,Backup=Required) to ensure all production volumes are included in automated backup policies. - Document your rollback plan – Before every change, write down the specific steps to revert if something goes wrong.
- Use maintenance windows – Apply changes during low-traffic periods to reduce blast radius.
- Consider creating an AMI – For major OS upgrades, create a full AMI (which includes all volumes) in addition to individual snapshots.
- Enable snapshot lock – For critical backups, use EBS Snapshot Lock to prevent accidental or malicious deletion during the retention period.
Summary
| Step | Action |
|---|---|
| Before any change | Create EBS snapshots of all attached volumes |
| For ongoing protection | Configure DLM or AWS Backup policies |
| After a successful change | Retain snapshots for your defined rollback window |
| If the change fails | Restore volumes from the pre-change snapshot |
The cost of a snapshot is negligible compared to the cost of production downtime. Make pre-change backups a non-negotiable part of your operational procedures.
Related Resources
- Recover an unbootable EC2 instance with kernel panic: https://repost.aws/knowledge-center/ec2-linux-kernel-panic-unable-mount
- Amazon Data Lifecycle Manager documentation: https://docs.aws.amazon.com/ebs/latest/userguide/snapshot-lifecycle.html
- AWS Backup documentation: https://docs.aws.amazon.com/aws-backup/latest/devguide/whatisbackup.html
- Create an Amazon EBS snapshot: https://docs.aws.amazon.com/ebs/latest/userguide/ebs-creating-snapshot.html
- EBS Snapshot Lock: https://docs.aws.amazon.com/ebs/latest/userguide/ebs-snapshot-lock.htm
- Recreate or recover a terminated Amazon EC2 instance: https://repost.aws/knowledge-center/recovery-terminated-instance
