Table of Content
- Create Snapshot (or use existing one)
- Create a volume from a snapshot
- Detach the old root volume
- Attach the new root volume
- Conclusion
1. Create Snapshot (or use existing one)
In our test, we first create an EBS Snapshot from an existing EBS volume. If you already have a snapshot, which you want to restore, you can skip this step and continue with step 2.
- Navigate to your
EC2 instance
->Storage
and select yourEBS volume
. - Click your
EBS Volume
and selectActions
->Create snapshot
Description
: My-EBS-Snapshot- Click
Create snapshot
- Under AWS Services
EC2
->Elastic Block Store
->Snapshots
you can see the status of the newly createdSnapshot
- Wait until the Snapshot status is
Completed
2. Create a volume from a snapshot
- Under AWS Services
EC2
->Elastic Block Store
->Snapshots
click on your newly createdSnapshot
- Choose
Actions
and clickCreate volume from snapshot
Volume type
: Choose the same volume type as the old EBS volume e.q.gp3
Size (GB)
: Choose the same size as the old EBSAvailability Zone
: Choose the same availability zone as the old EBS volume- Click on
Create volume
- Make not of the
Volume-Id
3. Detach the old root volume
- Under AWS Services
EC2
-> click on yourEC2 instance
->Storage
- You can see under
Root device details
your currentRoot device name
usually/dev/sda1
. This is the root device, which means you have to stop the instance first, in order to be able to replace it. - Keep note of the Device Name
/dev/sda1
- we need it later, when we want to attach the new volume Stop
the EC2 instance- Select the
EBS root volume
->Actions
->Detach volume
4. Attach the new root volume
- Find the new volume under
EC2
->Elastic Block Store
->Volumes
- Click
Actions
->Attach volume
Instance
: Choose your EC2 instance-idDevice name
:/dev/sda1
This must be the same device name as before!- Click
Attach volume
- Start your EC2 instance
- Your new volume status should change from
Available
toIn use
5. Conclusion
It's crucial to regularly practise your recovery plans. If you ever need need to restore your production EBS volume from a snapshot, you should not have to spend time researching how to do it. Instead, it is advisable, to have a step-by-step guide of the entire process. This is particularly important for production environments where time is limited and you may need to perform the recovery under pressure. I hope based on this guide, you can create your own step-by-step recovery plan for your production environment.