1. Take EBS snapshots of the production EBS volumes
- You create point-in-time backups of your EBS volumes.
- Snapshots are stored in Amazon S3 (behind the scenes).
- Command example:
aws ec2 create-snapshot --volume-id vol-xxxxxxxx --description "Production EBS snapshot"
2. Turn on the EBS Fast Snapshot Restore feature
- Normally, when restoring from an EBS snapshot, the first read requires initialization, which causes a delay.
- EBS Fast Snapshot Restore (FSR) keeps snapshots ready for instant volume creation in selected Availability Zones.
- This greatly reduces restore time (from minutes to seconds).
- Command example:
aws ec2 enable-fast-snapshot-restores \
--snapshot-ids snap-xxxxxxxx \
--availability-zones us-east-1a us-east-1b
⚡ Key: FSR has an additional cost, so it’s used when speed matters (e.g., testing, disaster recovery).
3. Restore the snapshots into new EBS volumes
- You create new volumes from the snapshots with FSR enabled so they are instantly available.
- Command example:
aws ec2 create-volume \
--snapshot-id snap-xxxxxxxx \
--availability-zone us-east-1a \
--volume-type gp3
4. Attach the new EBS volumes to EC2 instances in the test environment
- Attach the newly created volumes to EC2 instances so you can use them in your test environment.
- Command example:
aws ec2 attach-volume \
--volume-id vol-xxxxxxxx \
--instance-id i-xxxxxxxx \
--device /dev/sdf
Why this method is good
- Safe: You’re not touching production volumes directly.
- Fast: FSR makes snapshot restores nearly instant.
- Scalable: You can do this for many volumes.
- Cost-efficient for testing: Only pay for snapshots and volume usage, not for constant running storage.
Production Environment
+------------------------------------+
| EC2 Instance |
| +------------------------------+ |
| | EBS Volume (prod-data) | |
| +------------------------------+ |
+------------------------------------+
|
| Create Snapshot
v
+------------------------------------+
| EBS Snapshot (snap-prod-data) |
+------------------------------------+
|
| Enable Fast Snapshot Restore
v
+------------------------------------+
| Snapshot Ready for Fast Restore |
+------------------------------------+
|
| Restore into New EBS Volume
v
+------------------------------------+
| New EBS Volume (test-data) |
+------------------------------------+
|
| Attach to EC2
v
Test Environment
+------------------------------------+
| EC2 Instance |
| +------------------------------+ |
| | EBS Volume (test-data) | |
| +------------------------------+ |
+------------------------------------+
Top comments (0)