Create an AWS snapshot from a volume
I am going to do some work on my AWS EC2 instance that hosts my web site https://www.itsfullofstars.de. More precisely: I did the work already and it worked out well, that’s why you can read the blog Before starting the work, I wanted to have a backup of my data. The data is saved on a EBS volume and is also the root / boot volume / disk of my EC2 instance.
AWS has a nice documentation on how to create and manage snapshots. As always with this kind of generic documentation, it contains a lot of information, or too much, as all possible cases are covered. To have a simpler reference, I’ll show in this blog how I created a snapshot.
- EC2: Instance with root volume on EBS. OS: Linux
- Data: Size: 8 GB, type: gp2, SSD
- Task: Create a snapshot of the root device
Note that it seems that you can create a snapshot of a root volume while the instance is running. AWS states that you should stop the instance first:
„To create a snapshot for an Amazon EBS volume that serves as a root device, you should stop the instance before taking the snapshot.“
- Stop instance
- Create snapshot
- Start instance
Yes, 3 steps is all it takes to take a snapshot of a EBS volume used as root volume in a EC2 Linux instance.
Go to your EC2 instance and stop it. You can also log on to your instance and issue a stop command there. I am using the AWS console as here I can do everything without having to switch to another tool.
Select Stop, not Terminate, and confirm your action. Oh, yes, do not forget: afterwards your server is not online and its services not accessible. Plan for some downtime, communicate it, etc.
Instance state switches to stopping, meaning that the server is going to shut down. This can take a few seconds.
After the instance is stopped, the state is stopped. Now you can start creating a snapshot of your root volume, as it is not accessed anymore.
To create a snapshot, follow the stops outlined by AWS documentation. Go to create snapshot section in AWS console. In case you do not have any snapshots created yet, the list will be empty.
Let’s create a snapshot. To start, click on Create Snapshot. This will open a wizard. I wanted to create a snapshot of a volume, so I selected as type Volume and selected the volume from the dropdown list. It’s a good idea to provide a description.
To start the creation process, click on Create Snapshot.
The snapshot will be created immediately. Be aware: this means that the snapshot request was created, not the actual snapshot. Taking the snapshot / copy of the volume will take some time.
You can see the status of the snapshot creation in the column Status of the snapshot. It will be in state pending until all data was transferred from the root volume to the snapshot file.
Taking the snapshot can take a few minutes, depending on the size of your EBS volume. Mine was 8 GB and it took like 5-7 Minutes to create the snapshot. This was an initial snapshot, no delta. Only when the status changes to completed, the process ended successfully.
After the snapshot it taken, you can start the EC2 instance again.
During startup, the status of your EC2 instance will be pending. After completing, it is running and if everything worked without errors, your server and the services are back online.
cryptoratedump.com · September 4, 2019 at 06:53
After you’ve restored a volume from a snapshot, you can attach it to an instance to begin using it. For more information, see Attaching an Amazon EBS Volume to an Instance .
Tobias Hofmann · September 10, 2019 at 10:53
When you do have a snapshot, you can use it as an image for other instances. This blog is about how to get / create a snapshot.
David Eichner · December 3, 2020 at 18:08
We have a Lightsail AWS instance running windows server OS. It wouldnt let us snapshot while server was running so we shutdown the server and started the snapshot. It ran for awhile and then we needed to start the server again while the snapshot was still running. It let us do it…and the server started fine. The snapshot continued running. Any issues with this? Will the snapshot eventually fail because of this?
Increase EC2 (root) file system size | It`s full of stars! · July 16, 2019 at 10:01
[…] Before starting, create a snapshot of the volume. See my blog on how to do this. […]