Catalog My learning Blog
AWS Tutorial for Developers: From Account to Production · Phase 3 · Lesson 18 · 3 min read

AWS EBS vs Instance Store

On this page
  1. EBS vs instance store
  2. EBS volume types: gp3, io2, st1 and sc1
  3. Provisioning an EBS volume for a database
  4. Automating EBS snapshots
  5. Shared file storage: EFS and FSx
  6. Check yourself

EBS vs instance store

An instance's disks come in two kinds, and confusing them loses data. EBS (Elastic Block Store) volumes live on the network and persist on their own. Instance store disks are physically attached to the host, very fast, and erased when the instance stops, terminates or its host fails.

EBSInstance store
PersistenceSurvives stop, start and termination (if not set to delete)Lost on stop, termination or host failure
PerformanceUp to very high IOPS with io2, over the networkVery high, local NVMe
SnapshotsYes, to S3-backed storageNo
Resize or change typeOnline, with Elastic VolumesNo
Available onEvery instance typeOnly some types (with d in the name, like m7gd, or i families)
Use forRoot disks, databases, anything you need to keepCaches, scratch space, temporary data, replicated stores
EBS persists independently of the instance and can be snapshotted; instance store is fast local disk that's lost when the instance stops.
EBS persists independently of the instance and can be snapshotted; instance store is fast local disk that's lost when the instance stops.

An EBS volume lives in one Availability Zone and attaches to instances in that zone. Snapshots are the way to move or copy it elsewhere.

EBS volume types: gp3, io2, st1 and sc1

TypeWhat it isTypical use
gp3General purpose SSD. 3,000 IOPS and 125 MB/s baseline at any size; more IOPS and throughput can be provisioned separatelyDefault for almost everything
io2 Block ExpressProvisioned IOPS SSD with higher durability and the highest performanceLarge, latency-sensitive databases
st1Throughput-optimized HDDBig sequential reads: logs, data processing
sc1Cold HDDRarely accessed bulk data

If you see gp2 volumes, convert them to gp3: gp2 ties IOPS to size, and gp3 is cheaper per GB with independent performance settings. Elastic Volumes does it online.

Provisioning an EBS volume for a database

A PostgreSQL server needs 500 GB with 6,000 IOPS, encrypted (run against a local AWS emulator):

Shell
aws ec2 create-volume \
  --availability-zone us-east-1a \
  --size 500 --volume-type gp3 --iops 6000 --throughput 250 \
  --encrypted \
  --tag-specifications 'ResourceType=volume,Tags=[{Key=Name,Value=postgres-data}]' \
  --query '[VolumeId,VolumeType,Iops,Encrypted]' --output text
Code
vol-a895e40a292950e0f	gp3	6000	True

Then aws ec2 attach-volume --volume-id ... --instance-id ... --device /dev/xvdf, and format and mount it on the instance. On Nitro instances the volume shows up as an NVMe device such as /dev/nvme1n1. Turn on EBS encryption by default per region so nobody forgets --encrypted.

Automating EBS snapshots

Snapshots are point-in-time, incremental backups: only changed blocks are stored after the first. Automate them with Data Lifecycle Manager, targeting volumes by tag. The emulator doesn't implement DLM, so this was validated client-side:

Shell
aws dlm create-lifecycle-policy \
  --execution-role-arn arn:aws:iam::123456789012:role/AWSDataLifecycleManagerDefaultRole \
  --description "Daily postgres-data snapshots, 14-day retention" \
  --state ENABLED \
  --policy-details '{
    "ResourceTypes": ["VOLUME"],
    "TargetTags": [{"Key": "Name", "Value": "postgres-data"}],
    "Schedules": [{
      "Name": "daily",
      "CreateRule": {"Interval": 24, "IntervalUnit": "HOURS", "Times": ["03:00"]},
      "RetainRule": {"Count": 14},
      "CopyTags": true
    }]
  }'

AWS Backup does the same across EBS, RDS, DynamoDB, EFS and more, with cross-region and cross-account copies. A snapshot of a running database is crash-consistent, like pulling the power; databases recover from that, but application-consistent backups (flushing first, or using the database's own backup tools) are safer.

Shared file storage: EFS and FSx

EBS attaches to one instance at a time (apart from io2 Multi-Attach for clustered software). For a file system shared by many instances or containers, use EFS (NFS) or FSx (Windows, Lustre, NetApp, OpenZFS).

Check yourself

Instance store disks are physically attached to the host. Their data is lost when the instance stops, terminates or the underlying host fails, so they suit caches, scratch space and replicated data only.

gp3 is about 20 percent cheaper per GB and gives a 3,000 IOPS and 125 MB/s baseline regardless of size, with more performance provisioned separately. gp2 ties IOPS to size, so people overbuy storage just for speed. The change can be made in place without downtime.

EBS volumes live in one AZ. Take a snapshot, which is stored regionally, then create a new volume from that snapshot in the target AZ. Snapshots can also be copied to other regions.

When several instances or containers need the same files at once, since EFS is a shared network file system across AZs, while an EBS volume normally attaches to one instance.

Use Amazon Data Lifecycle Manager or AWS Backup with a schedule and retention policy based on tags, so new volumes are covered automatically.