"An EBS volume is a disk inside your server." It behaves like one, but it isn't. An Amazon EBS (Elastic Block Store) volume lives outside your EC2 instance and is reached over the network. That one fact explains most of its behaviour: why your data survives a stopped server, why a volume can't follow you to another zone, and why terminating an instance can still delete data you meant to keep.
What an EBS volume is
An EBS volume is block storage: to the operating system it looks like a raw hard drive. You format it with a file system (ext4, XFS, NTFS), mount it and install software on it, exactly as you would with a physical disk. Most instances boot from one (the root volume), and you can attach several more for data.
Because the volume is off-instance storage, it persists independently of the instance. You keep paying for it as long as it exists, whether an instance is using it or not.
One Availability Zone
Every volume is created in a single Availability Zone:
- AWS replicates the volume inside that zone, so the failure of one hardware component does not lose your data.
- You can attach it only to instances in the same zone.
- To move data to another zone, take a snapshot and create a new volume from it there.
Normally one volume attaches to one instance. The exception is Multi-Attach, which lets io1 and io2 volumes attach to up to 16 Nitro-based instances at once, and only works with software built to coordinate shared writes.
Stop, detach, terminate
- Stop an EBS-backed instance and the volume stays attached with its data intact. Start it again and everything is there.
- Detach a data volume and attach it to another instance in the same zone: a quick way to recover data from a broken server.
- Terminate is where people get caught. By default, the root volume is deleted with the instance, while extra volumes attached at launch are kept. Both are controlled by the
DeleteOnTerminationflag, which you can change at launch.
A common mistake is the opposite surprise: terminating test instances for months and never noticing the extra volumes they left behind, each still billed. Check the EC2 console's Volumes list for anything in the available (unattached) state.
Grow it while it runs
With Elastic Volumes, you can increase the size, change the volume type and adjust IOPS on a live volume attached to a current-generation instance, without stopping it. After growing a volume, extend the partition and file system inside the operating system so it can use the new space. Volumes can grow but not shrink: to get a smaller one, create a new volume and copy the data.
All volume types support encryption with AWS KMS keys, and you can turn on encryption by default for each Region in your account.
Where AI fits
Training jobs are hungry readers. Large datasets usually live in Amazon S3, but a common pattern is to copy the working set onto a fast EBS volume attached to the GPU instance, so every epoch reads from local block storage, and to write checkpoints there as the job runs. If the instance is replaced, the volume and its checkpoints can be attached to the new one (same zone), and snapshots copy them further. Size the volume's throughput, not only its gigabytes; the next post covers how.
Quick recap
- An EBS volume is a network-attached block device, not a disk inside the server.
- It lives in one Availability Zone, is replicated there, and attaches only to instances in that zone.
- Data survives stops; on terminate, the root volume is deleted by default while extra volumes are kept.
- You can grow and retype a volume while it runs, but not shrink it.