An EBS snapshot is a block-level, incremental backup of an EBS volume. The first snapshot saves the blocks in use; later snapshots save changes. For example, a 5 GiB volume containing 1 GiB of data produces a first snapshot of about 1 GiB. Snapshot storage is charged by the gigabytes used. section 8.1.4
Take snapshots regularly to prepare for volume failure or accidental data loss. To recover, create a new EBS volume from a snapshot; a snapshot does not itself replace an attached volume. section 8.1.4
A practical backup and restore sequence is:
- Find the EBS volume ID, then create a snapshot with aws ec2 create-snapshot --volume-id $VolumeId. section 8.1.4
- Check its progress with aws ec2 describe-snapshots --snapshot-ids $SnapshotId. Creation time depends on volume size and changed blocks. section 8.1.4
- Restore with aws ec2 create-volume --snapshot-id $SnapshotId --availability-zone us-east-1a, choosing the availability zone for the new volume. section 8.1.4
$ aws ec2 create-snapshot --volume-id $VolumeId #1
{
"Description": "",
"Encrypted": false,
"OwnerId": "163732473262",
"Progress": "",
"SnapshotId": "snap-0babfe807decdb918", #2
"StartTime": "2022-08-25T07:59:50.717000+00:00",
"State": "pending", #3
"VolumeId": "vol-043a5516bc104d9c6",
"VolumeSize": 5,
"Tags": []
}
The creation response supplies the SnapshotId needed for status checks and restoration. Its initial State is pending. section 8.1.4
Avoid snapshotting an attached, mounted volume while writes remain unflushed: detach the volume or stop its instance first. If it must stay in use, freeze writes with sudo fsfreeze -f /data, start the snapshot, and unfreeze with sudo fsfreeze -u /data once its state is pending. You need not keep writes frozen until completion. section 8.1.4
An EBS volume is available in only one availability zone, while snapshots are stored on S3 and can support recovery by creating a volume in another zone. That makes snapshots useful for recovery, not a substitute for storage that remains available across zones. For a root volume, use an AMI for backup instead; for file storage shared across zones, consider EFS. section 13.2.3 section 16.0
