How to make a daily back up of my ec2 instance?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
For an EC2 instance, a "daily backup" usually means daily EBS snapshots of the instance volumes, not copying the entire virtual machine image by hand every day. The safest approach depends on what you actually need to restore: a whole instance, only the attached disks, or the application data inside them.
For most workloads, the practical AWS-native choices are EBS snapshots through Data Lifecycle Manager or a backup plan through AWS Backup. Both let you automate daily recovery points instead of creating snapshots manually.
Decide What You Need to Restore
Before choosing a tool, separate these backup targets:
- the EC2 instance configuration
- the EBS volumes attached to the instance
- the application data stored on those volumes
If you only snapshot the volumes, you can recover the data and rebuild the instance around it. If you also want machine-level re-creation, you may additionally keep infrastructure as code, launch templates, or AMIs depending on the use case.
That distinction matters because "backup the EC2 instance" is often really "backup the persistent storage."
Use Automated EBS Snapshots
If your instance uses EBS volumes, daily snapshots are the standard backup mechanism. AWS can create point-in-time snapshots without you manually stopping the instance every day.
The core automation idea is:
- identify the volumes to protect
- apply a daily schedule
- define a retention rule
If you script the operation yourself, the essential AWS CLI call looks like this:
That creates one snapshot. The problem is not the command. It is the scheduling, tagging, retention, and cleanup around it. That is why most teams move quickly to managed automation instead of cron plus raw snapshot calls.
Prefer a Managed Daily Policy
Two common managed options are:
- EBS snapshot lifecycle automation
- AWS Backup plans
The advantage of a managed policy is that it handles repeated execution and retention consistently. Instead of remembering to create and prune snapshots yourself, you define the rule once and let AWS keep creating daily recovery points.
For example, a sane daily policy often means:
- run once every day
- keep the last 7, 14, or 30 snapshots
- tag backups clearly
That is enough for many small and medium EC2 recovery scenarios.
Think About Consistency, Not Just Scheduling
A backup is only useful if the data inside it is consistent enough to restore. For ordinary filesystems, EBS snapshots are often fine while the instance is running. But for busy databases or write-heavy applications, you may want application-aware preparation first.
That can mean:
- flushing pending writes
- freezing the filesystem briefly
- coordinating with the database engine
This is the difference between "a snapshot exists" and "the backup restores cleanly under stress." Daily automation is only half of the answer. Restore quality is the other half.
Test the Restore Path
Many backup setups look good until the first actual restore. The real validation step is to restore a volume or recovery point and verify that the application data is usable.
A practical test routine is:
- restore to a new volume or instance
- attach and mount the restored storage
- verify critical files or database state
That turns backups from a checkbox into an actual recovery plan.
Common Pitfalls
The biggest mistake is treating EC2 backup as a single feature when the real target is usually the EBS data.
Another common issue is creating snapshots daily without any retention policy. That works technically, but storage costs grow and backup sets become harder to manage.
It is also easy to assume a crash-consistent snapshot is always application-consistent. For simple workloads that may be good enough. For databases, you may need extra preparation.
Finally, do not skip restore testing. A backup that has never been restored is only partially verified.
Summary
- Daily EC2 backup usually means daily snapshots of attached EBS volumes.
- Automate the schedule and retention instead of creating snapshots manually forever.
- Use managed AWS backup policies when possible.
- Consider application consistency, not just snapshot existence.
- Test restores regularly so the backup process proves it can recover real data.
Related reading
- How to make all Objects in AWS S3 bucket public by default?
- how to make AWS api gateway accept http instead of https
- How to make CloudFront never cache index.html on S3 bucket
- How to make http cloud function only accessible from cloud endpoints
- How to make MSCK REPAIR TABLE execute automatically in AWS Athena
- How to make Terraform to read AWS Credentials file?
- How to make use of Kubernetes port names?
- How to making async calls to Amazon Bedrock

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.